2026-08-21 16:47:14 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Tests\Feature\OpenApi\V1\Health;
|
|
|
|
|
|
2026-10-06 14:51:46 +02:00
|
|
|
use Illuminate\Support\Facades\Config;
|
2026-08-21 16:47:14 +02:00
|
|
|
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);
|
|
|
|
|
});
|
2026-10-06 14:51:46 +02:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-08-21 16:47:14 +02:00
|
|
|
});
|