delete(); // WHEN & THEN $this->artisan('client:list') ->expectsOutput('No clients found.') ->assertSuccessful(); }); it('lists clients in a table when clients exist', function (): void { // GIVEN ApiClient::query()->delete(); $client1 = ApiClient::query()->create([ 'id' => (string) Uuid::uuid7(), 'name' => 'Gateway Alpha', 'identifier' => 'arcadia_id_' . str_repeat('a', 32), 'secret' => 'arcadia_sec_' . str_repeat('b', 86), 'is_active' => true, ]); $client2 = ApiClient::query()->create([ 'id' => (string) Uuid::uuid7(), 'name' => 'Gateway Beta', 'identifier' => 'arcadia_id_' . str_repeat('c', 32), 'secret' => 'arcadia_sec_' . str_repeat('d', 86), 'is_active' => false, ]); // WHEN & THEN $this->artisan('client:list') ->expectsTable( ['ID', 'Name', 'Identifier', 'Status', 'Created At', 'Updated At'], [ [ (string) $client1->id, (string) $client1->name->value, (string) $client1->identifier->value, 'Active', $client1->created_at->format('Y-m-d H:i:s'), $client1->updated_at->format('Y-m-d H:i:s'), ], [ (string) $client2->id, (string) $client2->name->value, (string) $client2->identifier->value, 'Inactive', $client2->created_at->format('Y-m-d H:i:s'), $client2->updated_at->format('Y-m-d H:i:s'), ], ] ) ->expectsOutput('Showing page 1/1 (Total: 2 client(s))') ->assertSuccessful(); }); it('respects pagination options', function (): void { // GIVEN ApiClient::query()->delete(); for ($i = 1; $i <= 3; $i++) { ApiClient::query()->create([ 'id' => (string) Uuid::uuid7(), 'name' => "Client {$i}", 'identifier' => 'arcadia_id_' . str_repeat((string) $i, 32), 'secret' => 'arcadia_sec_' . str_repeat((string) $i, 86), 'is_active' => true, ]); } // WHEN & THEN $this->artisan('client:list', ['--page' => '2', '--per-page' => '2']) ->expectsOutput('Showing page 2/2 (Total: 3 client(s))') ->assertSuccessful(); }); });