From d0ea93f103adfff85fde6a6058990a8a765cbde8 Mon Sep 17 00:00:00 2001 From: oittaa <8972248+oittaa@users.noreply.github.com> Date: Sun, 2 Jan 2022 06:33:58 +0100 Subject: [PATCH] Test `getTime` 10 times within a second (#33) --- tests/UuidTest.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/UuidTest.php b/tests/UuidTest.php index dc1e1f2..92dce5c 100644 --- a/tests/UuidTest.php +++ b/tests/UuidTest.php @@ -197,11 +197,14 @@ public function testKnownGetTime() public function testGetTimeValid() { - $now = microtime(true); - $uuid6 = UUID::uuid6(); - $uuid7 = UUID::uuid7(); - $this->assertEqualsWithDelta($now, UUID::getTime($uuid6), 0.001); - $this->assertEqualsWithDelta($now, UUID::getTime($uuid7), 0.001); + for ($i = 1; $i <= 10; $i++) { + $now = microtime(true); + $uuid6 = UUID::uuid6(); + $uuid7 = UUID::uuid7(); + $this->assertEqualsWithDelta($now, UUID::getTime($uuid6), 0.001); + $this->assertEqualsWithDelta($now, UUID::getTime($uuid7), 0.001); + usleep(100000); + } } public function testGetTimeNull()