diff --git a/app/Commands/DriverManagerCommand.php b/app/Commands/DriverManagerCommand.php index 0e43001..6a2d9da 100644 --- a/app/Commands/DriverManagerCommand.php +++ b/app/Commands/DriverManagerCommand.php @@ -46,8 +46,8 @@ public function handle(): int 'stop' => 'Stop a server', 'restart' => 'Restart a server', 'status' => 'Status of a server', - 'list' => 'List all the server available in the system', - 'kill' => 'Kill all the servers available in the system', + 'list' => 'List all the server', + 'kill' => 'Kill all the servers', ]); $callable = match ($action) { @@ -179,6 +179,8 @@ protected function kill(): int return self::FAILURE; } + $this->table(['PID', 'PORT'], $pids); + if (! $this->confirm('Are you sure you want to do this?')) { return self::SUCCESS; } diff --git a/tests/Feature/ManageDriverCommandTest.php b/tests/Feature/ManageDriverCommandTest.php index 7ad3ed6..28384c8 100644 --- a/tests/Feature/ManageDriverCommandTest.php +++ b/tests/Feature/ManageDriverCommandTest.php @@ -127,6 +127,11 @@ ]); artisan('manage:driver', ['action' => 'kill']) + ->expectsTable(['PID', 'PORT'], collect($data)->map(function (string $value) { + $values = explode(" ", $value); + + return ['pid' => $values[0], 'port' => $values[1]]; + })) ->expectsConfirmation('Are you sure you want to do this?', 'yes') ->expectsOutputToContain('Stopping all the Google Chrome Driver servers that are available in the system') ->expectsOutputToContain('Stopping Google Chrome Driver [PID: 9991]')