value)->toBe((string) $uuid); }); it('can be casted to string', function (): void { // GIVEN / WHEN $uuid = Uuid::uuid7(); $id = new DummyUuidv7EntityId($uuid); // THEN expect((string) $id)->toBe((string) $uuid); }); it('can be compared for equality', function (): void { // GIVEN / WHEN $uuid = Uuid::uuid7(); $id1 = new DummyUuidv7EntityId($uuid); $id2 = new DummyUuidv7EntityId($uuid); // THEN expect($id1->equals($id2))->toBeTrue(); }); it('can be converted to a datetime', function (): void { // GIVEN / WHEN $uuid = Uuid::uuid7(); $id = new DummyUuidv7EntityId($uuid); // THEN expect($id->toDateTime())->toBeInstanceOf(\DateTimeImmutable::class); }); }); describe('uuidv7 entity id validation rules', function (): void { it('should throw an exception when non v7 UUID is used', function (): void { // GIVEN $uuid = Uuid::uuid4(); // THEN $this->expectException(\DomainException::class); // WHEN new DummyUuidv7EntityId($uuid); }); });