['Viande de dinde (66%)', 'Eau', 'Sel'], ]; // WHEN $ingredients = new Ingredients($groups); // THEN expect($ingredients->groups)->toBe($groups); }); }); describe('Ingredients Value Object Domain Rules', function (): void { it('throws DomainException for empty ingredient line', function (): void { // GIVEN $groups = [ 'Ingrédients' => [' '], ]; // WHEN & THEN expect(fn () => new Ingredients($groups)) ->toThrow(\DomainException::class, 'string should not be empty'); }); it('throws DomainException for non-string ingredient line', function (): void { // GIVEN $groups = [ 'Ingrédients' => [123], ]; // WHEN & THEN expect(fn () => new Ingredients($groups)) ->toThrow(\DomainException::class, 'value must be a string'); }); it('throw DomainException for non-array ingredient group', function (): void { // GIVEN $groups = [ 'Ingrédients' => 'Viande de dinde (66%)', ]; // WHEN & THEN expect(fn () => new Ingredients($groups)) ->toThrow(\DomainException::class, 'value must be an array of strings'); }); });