clear(); }); it('executes successfully and returns Output when inco sheet exists', function () use ($directory): void { // GIVEN $incoId = new IncoId('12345'); $incoSheet = new IncoSheet( id: $incoId, name: 'Poulet Rôti 1kg', label: 'Poulet Rôti Classe A', description: 'Poulet prêt à cuire', allegations: new Allegations(['Volaille française']), sellArguments: 'Délicieux', preparationAdvices: 'Cuire 45min à 180°C', tips: null, sellFamilly: 'Boucherie', ingredients: new Ingredients(['Ingrédients' => ['Viande de dinde (66%)']]), portions: null, allergens: [], brand: new Brand('M01', 'Le Gaulois'), isSeasonal: true, weight: null, nutriscore: null, storageCondition: null, additives: [], compo: null, createdAt: null, updatedAt: null, ); $directory->add($incoSheet); $usecase = new FindIncoSheet($directory); $input = new Input($incoId); // WHEN $result = $usecase->execute($input); // THEN expect($result)->toBeInstanceOf(Output::class) ->and($result->id)->toBe($incoId) ->and($result->name)->toBe('Poulet Rôti 1kg') ->and($result->label)->toBe('Poulet Rôti Classe A') ->and($result->brand->label)->toBe('Le Gaulois') ->and($result->isSeasonal)->toBeTrue(); }); it('throws NotFoundException when inco sheet does not exist', function () use ($directory): void { // GIVEN $incoId = new IncoId('99999'); $usecase = new FindIncoSheet($directory); $input = new Input($incoId); // WHEN & THEN expect(fn () => $usecase->execute($input)) ->toThrow(IncoSheetNotFoundException::class, "IncoSheet '99999' not found."); }); });