Skip to content

Commit

Permalink
test: assert from known time string
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Oct 8, 2023
1 parent e48efdc commit a84bccb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/phpunit/UlidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,12 @@ public function testGetDateTime():void {
$sut->getDateTime()->getTimestamp()
);
}

public function testGetDateTime_constructorInit():void {
$dateTimeString = "1988-05-04 17:24";
$knownUlid = new Ulid(timestamp: strtotime($dateTimeString) * 1000);

$sut = new Ulid(init: $knownUlid);
self::assertSame($dateTimeString, $sut->getDateTime()->format("Y-m-d H:i"));
}
}

0 comments on commit a84bccb

Please sign in to comment.