ldc-arcadia-api/tests/Support/Mothers/IncoCompositionMother.php

60 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Support\Mothers;
use Application\Arcadia\Usecase\IncoCompositions\Find\Output;
use Domain\Models\Entities\Inco\Composition\IncoComposition;
use Tests\Support\Builders\IncoCompositionTestBuilder;
final class IncoCompositionMother
{
public static function create(?string $compoId = null, ?string $incoId = null, ?string $name = null): IncoComposition
{
$builder = IncoCompositionTestBuilder::create();
if ($compoId !== null) {
$builder->withId($compoId);
}
if ($incoId !== null) {
$builder->withIdInco($incoId);
}
if ($name !== null) {
$builder->withIdentification($name);
}
return $builder->build();
}
public static function createOutput(?string $compoId = null, ?string $incoId = null, ?string $name = null): Output
{
$builder = IncoCompositionTestBuilder::create();
if ($compoId !== null) {
$builder->withId($compoId);
}
if ($incoId !== null) {
$builder->withIdInco($incoId);
}
if ($name !== null) {
$builder->withIdentification($name);
}
return $builder->buildOutput();
}
public static function pouletRoti(): IncoComposition
{
return IncoCompositionTestBuilder::create()
->withId('67890')
->withIdInco('12345')
->withIdentification('Poulet Rôti 1kg', '12345', 'LDC')
->withNutriScore('B', '2')
->build();
}
}