diff --git a/tests/unit/utility/UUIDTest.php b/tests/unit/utility/UUIDTest.php index cb1297a9f..bb62bddbd 100644 --- a/tests/unit/utility/UUIDTest.php +++ b/tests/unit/utility/UUIDTest.php @@ -134,6 +134,24 @@ public function testV4(): void $this->assertTrue(UUID::validate(UUID::v4())); } + /** + * + */ + public function testV4Sequential(): void + { + $prev = UUID::v4Sequential(); + + for ($i = 0; $i < 100; $i++) { + usleep(10); // We need to sleep since they cannot be guaranteed to be 100% sequential due to the time presision + + $uuid = UUID::v4Sequential(); + + $this->assertTrue(strcmp($prev, $uuid) <= 0); + + $prev = $uuid; + } + } + /** * */ @@ -161,22 +179,4 @@ public function testV5WithInvalidNamespace(): void UUID::v5('nope', 'foobar'); } - - /** - * - */ - public function testSequential(): void - { - $prev = UUID::v4Sequential(); - - for ($i = 0; $i < 100; $i++) { - usleep(10); // We need to sleep since they cannot be guaranteed to be 100% sequential due to the time presision - - $uuid = UUID::v4Sequential(); - - $this->assertTrue(strcmp($prev, $uuid) <= 0); - - $prev = $uuid; - } - } }