ldc-arcadia-api/tests/Unit/Application/Arcadia/Usecase/IncoSheets/FindIncoSheetDtoTest.php

65 lines
2 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Application\Arcadia\Usecase\IncoSheets;
use Application\Arcadia\Usecase\IncoSheets\Find\Input;
use Application\Arcadia\Usecase\IncoSheets\Find\Output;
use Domain\Models\ValueObjects\Brand\ArcadiaId;
use Domain\Models\ValueObjects\Brand\BrandCode;
use Domain\Models\ValueObjects\Brand\BrandName;
use Domain\Models\ValueObjects\Inco\Allegations;
use Domain\Models\ValueObjects\Inco\IncoBrand;
use Domain\Models\ValueObjects\Inco\IncoId;
use Domain\Models\ValueObjects\Inco\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 IncoBrand(new BrandName('Le Gaulois'), new BrandCode('LGL01'), new ArcadiaId('1')),
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();
});
});