withId($id) ->withIdInco($idInco) ->withIdentification($identification) ->withEnergy($energy) ->withReferenceMacronutrients($refMacronutrients) ->withPortionMacronutrients($portionMacronutrients) ->withFreshProduceAndNuts($freshProduce) ->withReferenceIntakes($referenceIntakes) ->withNutriScore($nutriScore) ->withNutriScorePoints($nutriScorePoints) ->withMinerals($minerals) ->withVitamins($vitamins) ->withCarbohydratesDetail($carbohydratesDetail) ->withFattyAcids($fattyAcids) ->withAminoAcids($aminoAcids) ->withSpecialCompounds($specialCompounds) ->build(); // THEN expect($compo)->toBeInstanceOf(IncoComposition::class) ->and($compo->id())->toBe($id) ->and($compo->idInco)->toBe($idInco) ->and($compo->identification->name)->toBe('Poulet Rôti') ->and($compo->nutriScore->grade)->toBe('D'); }); it('throws DomainException when required fields are missing', function (): void { // GIVEN $builder = new IncoCompositionBuilder(); // WHEN expect(fn () => $builder->build()) // THEN ->toThrow(\DomainException::class, 'Cannot build IncoComposition: missing required components.'); }); });