29 lines
688 B
PHP
29 lines
688 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Tests\Unit\Domain\Models\ValueObjects;
|
||
|
|
|
||
|
|
use Domain\Models\ValueObjects\SessionId;
|
||
|
|
use Ramsey\Uuid\Uuid;
|
||
|
|
|
||
|
|
describe('SessionId', function (): void {
|
||
|
|
it('can be instantiated with a valid uuid', function (): void {
|
||
|
|
// GIVEN
|
||
|
|
$uuid = Uuid::uuid7();
|
||
|
|
// WHEN
|
||
|
|
$id = new SessionId($uuid);
|
||
|
|
// THEN
|
||
|
|
expect($id->value)->toBe($uuid);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('throws exception with non v7 uuid', function (): void {
|
||
|
|
// GIVEN
|
||
|
|
$uuid = Uuid::uuid4();
|
||
|
|
// WHEN
|
||
|
|
$action = fn () => new SessionId($uuid);
|
||
|
|
// THEN
|
||
|
|
expect($action)->toThrow(\DomainException::class);
|
||
|
|
});
|
||
|
|
});
|