From 4a44aeab2ea48b2ba7f000e9a251241a5b5cfb9a Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Thu, 20 Feb 2020 17:23:32 -0600 Subject: [PATCH] Add a test for the Unix epoch with v1 UUIDs --- tests/UuidTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/UuidTest.php b/tests/UuidTest.php index 97d8b8a..ed65eb7 100644 --- a/tests/UuidTest.php +++ b/tests/UuidTest.php @@ -204,6 +204,12 @@ class UuidTest extends TestCase $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('1582-10-15T00:00:00+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('-12219292800.000000', $uuid->getDateTime()->format('U.u')); + + // The Unix epoch + $uuid = Uuid::fromString('13814000-1dd2-11b2-9669-00007ffffffe'); + $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); + $this->assertSame('1970-01-01T00:00:00+00:00', $uuid->getDateTime()->format('c')); + $this->assertSame('0.000000', $uuid->getDateTime()->format('U.u')); } public function testGetDateTimeFromNonVersion1Uuid(): void