ldc-arcadia-api/tests/Unit/Application/Usecase/Incosheets/FindIncoSheetDtoTest.php
Jérémy Munsch 152ee2b5a2
feat(api): add IncoSheets feature with DDD clean architecture, tests & OpenAPI spec
- Use cases: FindAllIncoSheets & FindIncoSheet (filters, pagination, short projection)
- Presentation: controllers, FormRequests with scalar validation, DTOs (camelCase)
- Ports & Adapters: IncoSheetDirectory & EloquentIncoSheetDirectory
- Tests: Pest 4 unit, integration, OpenAPI spectator conformance, dynamic arch tests
- Docs: updated Bruno collection and OpenAPI spec
2026-08-14 11:33:05 +02:00

62 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Application\Usecase\IncoSheets;
use Application\Usecase\IncoSheets\Find\Input;
use Application\Usecase\IncoSheets\Find\Output;
use Domain\Models\ValueObjects\Entities\IncoId;
use Domain\Models\ValueObjects\IncoSheets\Allegations;
use Domain\Models\ValueObjects\IncoSheets\Brand;
use Domain\Models\ValueObjects\IncoSheets\Ingredients;
covers(Input::class, Output::class);
describe('FindIncoSheet DTO Instantiation', function (): void {
it('can instantiate Input DTO', function (): void {
// GIVEN
$id = new IncoId('12345');
// WHEN
$input = new Input($id);
// THEN
expect($input->id)->toBe($id);
});
it('can instantiate Output DTO', function (): void {
// GIVEN
$id = new IncoId('12345');
// WHEN
$output = new Output(
id: $id,
name: 'Poulet Rôti 1kg',
label: 'Poulet Rôti Classe A',
description: 'Poulet prêt à cuire',
allegations: new Allegations(['Volaille française']),
sellArguments: 'Origine France',
preparationAdvices: 'Cuire 45min',
tips: null,
sellFamilly: 'Volaille',
ingredients: new Ingredients(['main' => ['Viande']]),
portions: null,
allergens: [],
brand: new Brand('M01', 'Le Gaulois'),
isSeasonal: true,
weight: null,
nutriscore: null,
storageCondition: null,
additives: [],
compo: null,
createdAt: null,
updatedAt: null,
);
// THEN
expect($output->id)->toBe($id)
->and($output->name)->toBe('Poulet Rôti 1kg')
->and($output->isSeasonal)->toBeTrue();
});
});