1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00

Add more grace periods for timing dependent tests

This commit is contained in:
Niklas Keller 2017-04-26 21:37:09 +02:00
parent 34d4206e8f
commit 17224616aa
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -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);
}
}