Skip to content

Commit 441fe92

Browse files
committed
test: adapt time protection test for windows
1 parent bf5f34c commit 441fe92

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/cryptography/tests/Signing/SignerTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ public function test_time_protection(): void
176176
$this->assertTrue($signer->verify($data, $signature));
177177
$elapsed = microtime(true) - $start;
178178

179-
$this->assertGreaterThanOrEqual(0.3, $elapsed);
179+
$this->assertGreaterThanOrEqual(0.29, $elapsed);
180+
$this->assertLessThanOrEqual(0.311, $elapsed);
180181
}
181182

182183
public function test_time_protection_with_mock_clock(): void
@@ -194,6 +195,7 @@ public function test_time_protection_with_mock_clock(): void
194195
$this->assertTrue($signer->verify($data, $signature));
195196
$elapsed = $clock->timestamp()->getMilliseconds() - $ms;
196197

197-
$this->assertSame(1_000, $elapsed);
198+
$this->assertLessThanOrEqual(1_001, $elapsed);
199+
$this->assertGreaterThanOrEqual(999, $elapsed);
198200
}
199201
}

0 commit comments

Comments
 (0)