- Add methods to convert OrderLine and DeliveryAddress to DTOs. - Introduce toPlacedEvent method in Order to generate domain event. - Enhance OrderUnit with Regate code mapping. - Implement tests for new functionality and ensure correctness.
24 lines
607 B
PHP
24 lines
607 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Domain\Enums\Units;
|
|
|
|
use Domain\Enums\Units\OrderUnit;
|
|
|
|
describe('OrderUnit', function (): void {
|
|
it('returns the correct Regate code for each unit', function (OrderUnit $unit, string $expectedCode): void {
|
|
// GIVEN
|
|
// $unit and $expectedCode from dataset
|
|
|
|
// WHEN
|
|
$code = $unit->toRegateCode();
|
|
|
|
// THEN
|
|
expect($code)->toBe($expectedCode);
|
|
})->with([
|
|
'colis' => [OrderUnit::COLIS, 'UEA'],
|
|
'kgm' => [OrderUnit::KGM, 'KGM'],
|
|
'pce' => [OrderUnit::PCE, 'UB'],
|
|
]);
|
|
});
|