$em =
(new \
ReflectionClass(EntityManager::
class))->
newInstanceWithoutConstructor();
$generator =
new UuidGenerator();
$this->
assertInstanceOf(UuidV6::
class,
$generator->
generate($em,
new Entity()));
$generator =
$generator->
randomBased();
$this->
assertInstanceOf(UuidV4::
class,
$generator->
generate($em,
new Entity()));
$generator =
$generator->
timeBased();
$this->
assertInstanceOf(UuidV6::
class,
$generator->
generate($em,
new Entity()));
$generator =
$generator->
nameBased('prop1', Uuid::NAMESPACE_OID
);
$this->
assertEquals(Uuid::
v5(new Uuid(Uuid::NAMESPACE_OID
), '3'
),
$generator->
generate($em,
new Entity()));
$generator =
$generator->
nameBased('prop2', Uuid::NAMESPACE_OID
);
$this->
assertEquals(Uuid::
v5(new Uuid(Uuid::NAMESPACE_OID
), '2'
),
$generator->
generate($em,
new Entity()));
$generator =
$generator->
nameBased('getProp4', Uuid::NAMESPACE_OID
);
$this->
assertEquals(Uuid::
v5(new Uuid(Uuid::NAMESPACE_OID
), '4'
),
$generator->
generate($em,
new Entity()));
$factory =
new UuidFactory(6, 6, 5, 5, null, Uuid::NAMESPACE_OID
);
$generator =
new UuidGenerator($factory);
$generator =
$generator->
nameBased('prop1'
);
$this->
assertEquals(Uuid::
v5(new Uuid(Uuid::NAMESPACE_OID
), '3'
),
$generator->
generate($em,
new Entity()));
}