clear(); }); it('executes successfully and returns Output when inco sheet exists', function () use ($directory): void { // GIVEN $incoId = new IncoId('12345'); $incoSheet = IncoSheetMother::create(id: '12345', name: 'Poulet Rôti 1kg'); $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->value)->toBe('12345') ->and($result->name)->toBe('Poulet Rôti 1kg') ->and($result->brand->name->value)->toBe('Le Gaulois') ->and($result->brand->code->value)->toBe('LGL01'); }); 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."); }); });