@@ -428,32 +428,39 @@ public function testFromStringBase58Padding()
428
428
$ this ->assertInstanceOf (Uuid::class, Uuid::fromString ('111111111u9QRyVM94rdmZ ' ));
429
429
}
430
430
431
- public function testV6FromV1 ()
431
+ public function testV1ToV6 ()
432
432
{
433
433
$ uuidV1 = new UuidV1 ('8189d3de-9670-11ee-b9d1-0242ac120002 ' );
434
- $ uuidV6 = UuidV6:: fromV1 ( $ uuidV1 );
434
+ $ uuidV6 = $ uuidV1-> toV6 ( );
435
435
436
436
$ this ->assertEquals ($ uuidV1 ->getDateTime (), $ uuidV6 ->getDateTime ());
437
437
$ this ->assertSame ($ uuidV1 ->getNode (), $ uuidV6 ->getNode ());
438
- $ this ->assertEquals ($ uuidV6 , UuidV6:: fromV1 ( $ uuidV1 ));
438
+ $ this ->assertEquals ($ uuidV6 , $ uuidV1-> toV6 ( ));
439
439
}
440
440
441
- public function testV7FromV1BeforeUnixEpochThrows ()
441
+ public function testV1ToV7BeforeUnixEpochThrows ()
442
442
{
443
443
$ this ->expectException (\InvalidArgumentException::class);
444
- $ this ->expectExceptionMessage ('UUIDv1 with a timestamp before Unix epoch cannot be converted to UUIDv7 ' );
444
+ $ this ->expectExceptionMessage ('Cannot convert UUID to v7: its timestamp is before the Unix epoch. ' );
445
445
446
- UuidV7:: fromV1 (new UuidV1 ('9aba8000-ff00-11b0-b3db-3b3fc83afdfc ' )); // Timestamp is 1969-01-01 00:00:00.0000000
446
+ (new UuidV1 ('9aba8000-ff00-11b0-b3db-3b3fc83afdfc ' ))-> toV7 ( ); // Timestamp is 1969-01-01 00:00:00.0000000
447
447
}
448
448
449
- public function testV7FromV1 ()
449
+ public function testV1ToV7 ()
450
450
{
451
451
$ uuidV1 = new UuidV1 ('eb248d80-ea4f-11ec-9d2a-839425e6fb88 ' );
452
452
$ sameUuidV1100NanosecondsLater = new UuidV1 ('eb248d81-ea4f-11ec-9d2a-839425e6fb88 ' );
453
- $ uuidV7 = UuidV7:: fromV1 ( $ uuidV1 );
453
+ $ uuidV7 = $ uuidV1-> toV7 ( );
454
454
455
455
$ this ->assertEquals ($ uuidV1 ->getDateTime (), $ uuidV7 ->getDateTime ());
456
- $ this ->assertEquals ($ uuidV7 , UuidV7::fromV1 ($ uuidV1 ));
457
- $ this ->assertNotEquals ($ uuidV7 , UuidV7::fromV1 ($ sameUuidV1100NanosecondsLater ));
456
+ $ this ->assertEquals ($ uuidV7 , $ uuidV1 ->toV7 ());
457
+ $ this ->assertNotEquals ($ uuidV7 , $ sameUuidV1100NanosecondsLater ->toV7 ());
458
+ }
459
+
460
+ public function testV1ToV7ExtraTimeEntropyDoesNotOverflow ()
461
+ {
462
+ $ this ->expectNotToPerformAssertions ();
463
+
464
+ (new UuidV1 ('13814000-1dd2-11b2-b7e1-baee6f90c96b ' ))->toV7 ();
458
465
}
459
466
}
0 commit comments