From 17224616aaadbdeb9e910f66502c6c9577a5f64c Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Wed, 26 Apr 2017 21:37:09 +0200 Subject: [PATCH] Add more grace periods for timing dependent tests --- test/Loop/DriverTest.php | 2 +- test/PauseTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Loop/DriverTest.php b/test/Loop/DriverTest.php index d7776b8..4f7c98b 100644 --- a/test/Loop/DriverTest.php +++ b/test/Loop/DriverTest.php @@ -1415,7 +1415,7 @@ abstract class DriverTest extends TestCase { } public function testTimerIntervalCountedWhenNotRunning() { - \usleep(502000); // 502ms instead of 500ms to allow for variations in timing. + \usleep(600000); // 600ms instead of 500ms to allow for variations in timing. $start = \microtime(true); $this->loop->delay(1000, function () use ($start) { $this->assertLessThan(0.5, \microtime(true) - $start); diff --git a/test/PauseTest.php b/test/PauseTest.php index 363954f..d5f86b3 100644 --- a/test/PauseTest.php +++ b/test/PauseTest.php @@ -67,7 +67,7 @@ class PauseTest extends \PHPUnit\Framework\TestCase { $promise->onResolve($callback); }); - $this->assertGreaterThanOrEqual($time, (microtime(true) - $start) * 1000); + $this->assertGreaterThanOrEqual($time - 1 /* 1ms grace period */, (microtime(true) - $start) * 1000); $this->assertTrue($invoked); } }