Skip to content

Commit

Permalink
test: add test coverage for timestamp exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed Oct 23, 2022
1 parent bcfb209 commit 06aa2dd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/unit/Ulid/DefaultUlidFactoryTest.php
Expand Up @@ -320,4 +320,12 @@ public function testCreateEachUlidFromSameDateTimeIsMonotonicallyIncreasing(): v
$previous = $ulid;
}
}

public function testCreateFromDateThrowsExceptionForTooEarlyTimestamp(): void
{
$this->expectException(InvalidArgument::class);
$this->expectExceptionMessage('Timestamp may not be earlier than the Unix Epoch');

$this->factory->createFromDateTime(new DateTimeImmutable('1969-12-31 23:59:59.999999'));
}
}

0 comments on commit 06aa2dd

Please sign in to comment.