use Symfony\Component\Uid\Uuid;
use Symfony\Component\Uid\UuidV1;
use Symfony\Component\Uid\UuidV3;
use Symfony\Component\Uid\UuidV4;
use Symfony\Component\Uid\UuidV5;
use Symfony\Component\Uid\UuidV6;
final class UuidFactoryTest extends TestCase
{ public function testCreateNamedDefaultVersion() { $this->
assertInstanceOf(UuidV5::
class,
(new UuidFactory())->
nameBased('6f80c216-0492-4421-bd82-c10ab929ae84'
)->
create('foo'
));
$this->
assertInstanceOf(UuidV3::
class,
(new UuidFactory(6, 6, 3
))->
nameBased('6f80c216-0492-4421-bd82-c10ab929ae84'
)->
create('foo'
));
} public function testCreateNamed() { $uuidFactory =
new UuidFactory();
// Test custom namespace
$uuid1 =
$uuidFactory->
nameBased('6f80c216-0492-4421-bd82-c10ab929ae84'
)->
create('foo'
);
$this->
assertInstanceOf(UuidV5::
class,
$uuid1);
$this->
assertSame('d521ceb7-3e31-5954-b873-92992c697ab9',
(string) $uuid1);