ldc-cocotte/tests/Unit/Domain/Models/ValueObjects/Entities/BasketIdTest.php

28 lines
711 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects\Entities;
use Domain\Models\ValueObjects\Entities\BasketId;
use Shared\Helpers\UuidHelper;
describe('BasketId', function (): void {
it('can be instantiated with a Uuid', function (): void {
// GIVEN
$uuid = UuidHelper::v7();
// WHEN
$id = new BasketId($uuid);
// THEN
expect($id->value)->toBe($uuid);
});
it('throws exception with non v7 uuid', function (): void {
// GIVEN
$uuid = UuidHelper::v4();
// WHEN
$action = fn () => new BasketId($uuid);
// THEN
expect($action)->toThrow(\DomainException::class);
});
});