artisan('health:check') // THEN ->expectsOutput('Health check passed. All components are healthy.') ->assertSuccessful(); }); it('returns failure when a component is unhealthy', function () use (&$originalDbDefault): void { // GIVEN /** @var \Tests\TestCase $this */ Config::set('database.default', 'invalid_connection'); // WHEN $this->artisan('health:check') // THEN ->expectsOutput('Health check failed. One or more components are unhealthy.') ->assertFailed(); }); it('outputs JSON when --json option is passed and succeeds when healthy', function (): void { // GIVEN /** @var \Tests\TestCase $this */ // WHEN $this->artisan('health:check', ['--json' => true]) // THEN ->expectsOutputToContain('"status": "healthy"') ->assertSuccessful(); }); it('outputs JSON when --json option is passed and fails when unhealthy', function () use (&$originalArcadiaDb): void { // GIVEN /** @var \Tests\TestCase $this */ Config::set('database.arcadia_meta_model', 'invalid_arcadia_connection'); // WHEN $this->artisan('health:check', ['--json' => true]) // THEN ->expectsOutputToContain('"status": "unhealthy"') ->assertFailed(); }); });