ldc-arcadia-api/tests/Feature/OpenApi/V1/IncoCompositions/IncoCompositionOpenApiTest.php
Jérémy Munsch 34b76cb397
test(feature): align feature and openapi tests with replicated Oracle tables
- Update tests to use factory static helpers and avoid hardcoded table/connection names
- Align test data columns with real replicated Oracle schema
- Remove obsolete duplicate IncoSheetsShowTest
2026-08-26 17:29:18 +02:00

45 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\OpenApi\V1\IncoCompositions;
use Database\ArcadiaReplicate\Factories\Refp\IncoCompoFactory;
use Database\ArcadiaReplicate\Factories\Refp\IncoFactory;
use Spectator\Spectator;
beforeEach(function (): void {
/** @var \Tests\TestCase $this */
Spectator::reset();
Spectator::using('openapi.yaml');
IncoFactory::truncate();
IncoCompoFactory::truncate();
});
describe('IncoComposition OpenAPI Conformance', function (): void {
it('validates GET /api/v1/inco-sheets/{incoId}/composition response against OpenAPI spec', function (): void {
// GIVEN
/** @var \Tests\TestCase $test */
$test = $this;
IncoFactory::new()->create([
'NO_ART' => 12345,
'REF_COMPO' => 67890,
]);
IncoCompoFactory::new()->create([
'ID' => 67890,
'ID_INCO' => 12345,
'NOM' => 'Poulet Rôti 1kg Test',
]);
// WHEN
$response = $test->getJson('/api/v1/inco-sheets/12345/composition');
// THEN
$response->assertStatus(200);
$response->assertValidRequest();
$response->assertValidResponse();
});
});