Skip to content

Commit d06e589

Browse files
committed
feature #61812 [Uid] Default to UuidV7 when using UuidFactory (nicolas-grekas)
This PR was merged into the 7.4 branch. Discussion ---------- [Uid] Default to `UuidV7` when using `UuidFactory` | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT UUIDv7 are how time-based UUIDs should have been from day 1 :) (+ some minor optims to Ulid while at it.) Commits ------- 2cc4f5fc6fe [Uid] Default to `UuidV7` when using `UuidFactory`
2 parents 6f00e1e + 33a8e6d commit d06e589

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Tests/IdGenerator/UuidGeneratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
1717
use Symfony\Component\Uid\Factory\UuidFactory;
18+
use Symfony\Component\Uid\TimeBasedUidInterface;
1819
use Symfony\Component\Uid\Uuid;
1920
use Symfony\Component\Uid\UuidV4;
20-
use Symfony\Component\Uid\UuidV6;
2121

2222
class UuidGeneratorTest extends TestCase
2323
{
@@ -47,13 +47,13 @@ public function testUuidfactory()
4747
{
4848
$em = (new \ReflectionClass(EntityManager::class))->newInstanceWithoutConstructor();
4949
$generator = new UuidGenerator();
50-
$this->assertInstanceOf(UuidV6::class, $generator->generate($em, new Entity()));
50+
$this->assertInstanceOf(TimeBasedUidInterface::class, $generator->generate($em, new Entity()));
5151

5252
$generator = $generator->randomBased();
5353
$this->assertInstanceOf(UuidV4::class, $generator->generate($em, new Entity()));
5454

5555
$generator = $generator->timeBased();
56-
$this->assertInstanceOf(UuidV6::class, $generator->generate($em, new Entity()));
56+
$this->assertInstanceOf(TimeBasedUidInterface::class, $generator->generate($em, new Entity()));
5757

5858
$generator = $generator->nameBased('prop1', Uuid::NAMESPACE_OID);
5959
$this->assertEquals(Uuid::v5(new Uuid(Uuid::NAMESPACE_OID), '3'), $generator->generate($em, new Entity()));

0 commit comments

Comments
 (0)