Skip to content

Commit baf90dd

Browse files
authored
Fix timing precision issues in delay tests on Windows (#72)
1 parent 9c69a96 commit baf90dd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tests/Integration/MockingIntegrationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ public function test_fake_with_delay(): void
229229
$response = get('https://api.example.com/slow');
230230
$duration = (microtime(true) - $start) * 1000;
231231

232-
$this->assertGreaterThanOrEqual(50, $duration);
232+
// Allow 2ms tolerance for timer precision issues on Windows
233+
$this->assertGreaterThanOrEqual(48, $duration);
233234
$this->assertSame('Done', $response->body());
234235
}
235236

tests/Unit/Testing/MockResponseTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public function test_executes_response_with_delay(): void
5454
$executed = $response->execute();
5555
$duration = (microtime(true) - $start) * 1000; // Convert to milliseconds
5656

57-
$this->assertGreaterThanOrEqual(10, $duration);
57+
// Allow 2ms tolerance for timer precision issues on Windows
58+
$this->assertGreaterThanOrEqual(8, $duration);
5859
$this->assertSame(200, $executed->status());
5960
$this->assertSame('Test', $executed->body());
6061
}

0 commit comments

Comments
 (0)