ldc-arcadia-api/tests/Feature/OpenApi/V1/Health/HealthOpenApiTest.php
Jérémy Munsch 62c221f6b6
feat(health): add oracle probe and normalize health checks
Refactor health check DTOs around a common CheckResult contract and remove the\nlegacy HealthChecks aggregate object.\n\nAdd a dedicated /api/v1/health/oracle endpoint with response mapping, OpenAPI\nschema updates, and Bruno request coverage.\n\nAlign feature, unit, integration, architecture and OpenAPI tests with the new\nset-based checks representation and make Oracle health tests deterministic in CI.\n\nUpdate command documentation to the uwil:* command namespace.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-06 14:51:46 +02:00

50 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\OpenApi\V1\Health;
use Illuminate\Support\Facades\Config;
use Spectator\Spectator;
use Tests\TestCase;
beforeEach(function (): void {
Spectator::reset();
Spectator::using('openapi.yaml');
});
describe('Health Check OpenAPI Conformance', function (): void {
it('validates GET /api/v1/health response against openapi spec', function (): void {
// GIVEN
/** @var TestCase $this */
// WHEN
/** @var \Illuminate\Testing\TestResponse<\Symfony\Component\HttpFoundation\Response> $response */
$response = $this->getJson('/api/v1/health');
// THEN
$response->assertStatus(200);
$response->assertValidRequest();
$response->assertValidResponse(200);
});
it('validates GET /api/v1/health/oracle response against openapi spec', function (): void {
// GIVEN
/** @var TestCase $this */
$originalArcadiaDb = Config::get('database.arcadia_meta_model');
Config::set('database.arcadia_meta_model', 'sqlite');
try {
// WHEN
/** @var \Illuminate\Testing\TestResponse<\Symfony\Component\HttpFoundation\Response> $response */
$response = $this->getJson('/api/v1/health/oracle');
// THEN
$response->assertStatus(200);
$response->assertValidRequest();
$response->assertValidResponse(200);
} finally {
Config::set('database.arcadia_meta_model', $originalArcadiaDb);
}
});
});