Skip to content

Commit

Permalink
add new asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Oct 30, 2023
1 parent fcb56e9 commit db5dd3d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/unit/UlidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit db5dd3d

Please sign in to comment.