39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature\OpenApi\V1\IncoCompositions;
|
|
|
|
use Infra\Database\Models\IncoCompo;
|
|
use Infra\Database\Models\IncoSheet;
|
|
|
|
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;
|
|
|
|
$sheet = IncoSheet::factory()->create([
|
|
'id' => '12345',
|
|
'compo_id' => '67890',
|
|
]);
|
|
|
|
IncoCompo::factory()->create([
|
|
'id' => '67890',
|
|
'id_inco' => '12345',
|
|
'identification' => [
|
|
'name' => 'Poulet Rôti 1kg Test',
|
|
'number' => '12345',
|
|
'source' => 'LDC',
|
|
],
|
|
]);
|
|
|
|
// WHEN
|
|
$response = $test->getJson("/api/v1/inco-sheets/{$sheet->id}/composition");
|
|
|
|
// THEN
|
|
$response->assertStatus(200);
|
|
$response->assertValidRequest();
|
|
$response->assertValidResponse();
|
|
});
|
|
});
|