1000101, 'DENOM_LEG' => 'Poulet Rôti 1kg', 'DESCRIPTIF' => 'Délicieux poulet rôti cuit au four', 'DAT_CRE' => '2024-01-15', 'DAT_MAJ' => '2024-06-20', ]; // WHEN $entity = IncoShortMapper::toDomain($row); // THEN expect($entity)->toBeInstanceOf(IncoShortSheet::class) ->and((string) $entity->id->value)->toBe('1000101') ->and($entity->name)->toBe('Délicieux poulet rôti cuit au four.') ->and($entity->label)->toBe('Poulet Rôti 1Kg') ->and($entity->description)->toBe('Délicieux poulet rôti cuit au four.') ->and($entity->createdAt?->format('Y-m-d'))->toBe('2024-01-15') ->and($entity->updatedAt?->format('Y-m-d'))->toBe('2024-06-20'); }); it('maps an object row and derives name when descriptif is missing', function (): void { // GIVEN $row = (object) [ 'no_art' => '1000102', 'denom_leg' => 'Salade Niçoise au Thon', ]; // WHEN $entity = IncoShortMapper::toDomain($row); // THEN expect($entity)->toBeInstanceOf(IncoShortSheet::class) ->and((string) $entity->id->value)->toBe('1000102') ->and($entity->label)->toBe('Salade Niçoise Au Thon') ->and($entity->description)->toBe(''); }); });