From db5dd3df88faf05426cf389db8da468e15214226 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 30 Oct 2023 18:27:47 -0400 Subject: [PATCH] add new asserts --- tests/unit/UlidTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/UlidTest.php b/tests/unit/UlidTest.php index 373144d..fa7820c 100644 --- a/tests/unit/UlidTest.php +++ b/tests/unit/UlidTest.php @@ -30,6 +30,7 @@ protected function tearDown() public function testGenerate() { $ulid1 = Ulid::generate(); + $this->assertTrue(Ulid::isValid($ulid1)); usleep(2000); // Wait for 2 milliseconds to ensure a different timestamp $ulid2 = Ulid::generate(); @@ -73,7 +74,9 @@ public function testGeneratesTwentySixChars() public function testRandomnessWhenGeneratedMultipleTimes() { $a = Ulid::generate(); + usleep(100); // Wait for 100 microseconds to ensure a different timestamp $b = Ulid::generate(); + $this->assertLessThan($a, $b); // The time parts are different. $this->assertNotEquals(substr($a, 0, 10), substr($b, 0, 10));