delete(); // WHEN $this->artisan('arcadia:client:list') // THEN ->expectsOutput('No clients found.') ->assertSuccessful(); }); it('outputs table of clients when clients exist', function (): void { // GIVEN /** @var \Tests\TestCase $this */ ApiClient::query()->delete(); $client1 = ApiClient::factory()->create([ 'id' => (string) Uuid::uuid7(), 'name' => 'Production Gateway', 'slug' => 'test-' . uniqid(), 'identifier' => 'arcadia_id_' . str_repeat('a', 32), 'secret' => 'arcadia_sec_' . str_repeat('b', 86), 'is_active' => true, ]); $client2 = ApiClient::factory()->create([ 'id' => (string) Uuid::uuid7(), 'name' => 'Backup Gateway', 'slug' => 'test-' . uniqid(), 'identifier' => 'arcadia_id_' . str_repeat('c', 32), 'secret' => 'arcadia_sec_' . str_repeat('d', 86), 'is_active' => false, ]); // WHEN $this->artisan('arcadia:client:list') // THEN ->expectsTable( ['ID', 'Name', 'Identifier', 'Status', 'Last Updated At'], [ [ (string) $client1->id, (string) $client1->name->value, (string) $client1->identifier->value, 'Active', Utc::toRfc3339($client1->updated_at), ], [ (string) $client2->id, (string) $client2->name->value, (string) $client2->identifier->value, 'Inactive', Utc::toRfc3339($client2->updated_at), ], ] ) ->expectsOutput('Showing page 1/1 (Total: 2 client(s))') ->assertSuccessful(); }); it('respects pagination options', function (): void { // GIVEN /** @var \Tests\TestCase $this */ ApiClient::query()->delete(); for ($i = 1; $i <= 3; $i++) { ApiClient::factory()->create([ 'id' => (string) Uuid::uuid7(), 'name' => "Client {$i}", 'slug' => 'test-' . uniqid(), 'identifier' => 'arcadia_id_' . str_repeat((string) $i, 32), 'secret' => 'arcadia_sec_' . str_repeat((string) $i, 86), 'is_active' => true, ]); } // WHEN $this->artisan('arcadia:client:list', ['--page' => '2', '--per-page' => '2']) // THEN ->expectsOutput('Showing page 2/2 (Total: 3 client(s))') ->assertSuccessful(); }); });