clear(); }); it('executes successfully and returns Output when composition exists', function () use ($directory): void { // GIVEN $incoId = new IncoId('12345'); $composition = IncoCompositionMother::create(compoId: '67890', incoId: '12345'); $directory->add($composition); $usecase = new FindIncoComposition($directory); $input = new Input($incoId); // WHEN $output = $usecase->execute($input); // THEN expect($output)->toBeInstanceOf(Output::class) ->and($output->id->value)->toBe('67890') ->and($output->idInco->value)->toBe('12345'); }); it('throws NotFoundException when composition does not exist', function () use ($directory): void { // GIVEN $incoId = new IncoId('99999'); $usecase = new FindIncoComposition($directory); $input = new Input($incoId); // WHEN & THEN expect(fn () => $usecase->execute($input))->toThrow(IncoCompositionNotFoundException::class); }); });