add($brand); $brandCodeGenerator = new BrandCodeGenerator(); $dispatcher = \Mockery::mock(DomainEventDispatcher::class); $brandResolver = new BrandResolver($arcadiaDirectory, $brandRepository, $brandCodeGenerator, $dispatcher); $mapper = new IncoMapper($brandResolver); $row = [ 'NO_ART' => 47789, 'DENOM_LEG' => 'Viande de poulet traitée en salaison, panée et cuite', 'DESCRIPTIF' => 'Nuggets de poulet du volailler LE GAULOIS', 'ASTUCES' => 'Pour plus de croustillance, cuisson au Air Fryer', 'CONSEIL_PREPA' => 'Au four chaud pendant 10 minutes', 'ARG_VENTE' => 'Une volaille 100% française', 'ALLEGATIONS' => 'sans conservateur, sans huile de palme', 'LST_ING' => 'Viande de poulet 51%, eau, panure 30%.', 'NB_PORTION' => '10', 'TYP_PORTION' => 'exact', 'LST_ALLERGENE' => '1:Gluten;7:Lait', 'MARQUE' => 1, 'FAMILLE_VTE_LIBELLE' => 'PRODUITS CUITS & PANES', 'PDS_NET_UVC' => 300.0, 'PDS_BRUT_UVC' => 320.0, 'NUTRISCORE_ON_PACK' => 'B', 'CONDIT_CONSERV' => 'A conserver entre 0°C et +4°C', 'LST_ADDITIF' => 'E300:Acide ascorbique', 'PROD_SAISON' => 0, 'REF_COMPO' => 96504, 'DAT_CRE' => '2024-01-15', 'DAT_MAJ' => '2024-06-20', ]; $sheet = $mapper->toDomain($row); expect($sheet)->toBeInstanceOf(IncoSheet::class) ->and((string) $sheet->id->value)->toBe('47789') ->and($sheet->name)->toBe('Nuggets de poulet du volailler le gaulois.') ->and($sheet->label)->toBe('Viande De Poulet Traitée En Salaison, Panée Et Cuite') ->and($sheet->brand->code->value)->toBe('LGL01') ->and($sheet->brand->name->value)->toBe('Le Gaulois') ->and($sheet->sellFamilly)->toBe('Produits cuits & panes') ->and($sheet->nutriscore?->grade)->toBe('B') ->and((string) $sheet->compo?->value)->toBe('96504') ->and($sheet->allergens)->toHaveCount(2) ->and($sheet->additives)->toHaveCount(1) ->and($sheet->isSeasonal)->toBeFalse(); }); });