mirror of
https://github.com/danog/amp.git
synced 2024-11-27 04:24:42 +01:00
Add more grace periods for timing dependent tests
This commit is contained in:
parent
34d4206e8f
commit
17224616aa
@ -1415,7 +1415,7 @@ abstract class DriverTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testTimerIntervalCountedWhenNotRunning() {
|
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);
|
$start = \microtime(true);
|
||||||
$this->loop->delay(1000, function () use ($start) {
|
$this->loop->delay(1000, function () use ($start) {
|
||||||
$this->assertLessThan(0.5, \microtime(true) - $start);
|
$this->assertLessThan(0.5, \microtime(true) - $start);
|
||||||
|
@ -67,7 +67,7 @@ class PauseTest extends \PHPUnit\Framework\TestCase {
|
|||||||
$promise->onResolve($callback);
|
$promise->onResolve($callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->assertGreaterThanOrEqual($time, (microtime(true) - $start) * 1000);
|
$this->assertGreaterThanOrEqual($time - 1 /* 1ms grace period */, (microtime(true) - $start) * 1000);
|
||||||
$this->assertTrue($invoked);
|
$this->assertTrue($invoked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user