Skip to content

Commit

Permalink
tweak: make timestamp comparison less accurate to allow for time spen…
Browse files Browse the repository at this point in the history
…t generating ulid
  • Loading branch information
g105b committed Sep 13, 2023
1 parent 8e64144 commit c4e0e7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/phpunit/UlidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ public function testGetPrefix():void {
$sut = new Ulid("customer");
self::assertStringStartsWith("CUSTOMER_", $sut);
}

public function testGetTimestamp():void {
$sut = new Ulid();
$timestamp = round(microtime(true) * 1000);
self::assertSame(round($timestamp), round($sut->getTimestamp()));
$now = round(microtime(true) * 1000);
self::assertSame(round($now / 10), round($sut->getTimestamp() / 10));
}

public function testGetTimestamp_setInConstructor():void {
Expand Down

0 comments on commit c4e0e7f

Please sign in to comment.