@@ -26,13 +26,13 @@ public function testAddTimerWillBeInvokedOnceAndBlocksLoopWhenRunning()
26
26
{
27
27
$ loop = $ this ->createLoop ();
28
28
29
- $ loop ->addTimer (0.002 , $ this ->expectCallableOnce ());
29
+ $ loop ->addTimer (0.005 , $ this ->expectCallableOnce ());
30
30
31
31
$ start = microtime (true );
32
32
$ loop ->run ();
33
33
$ end = microtime (true );
34
34
35
- // 1 invocation should take 2ms (± 1ms due to timer inaccuracies)
35
+ // 1 invocation should take 5ms (± a few milliseconds due to timer inaccuracies)
36
36
// make no strict assumptions about time interval, must at least take 1ms
37
37
// and should not take longer than 0.1s for slower loops.
38
38
$ this ->assertGreaterThanOrEqual (0.001 , $ end - $ start );
@@ -57,7 +57,7 @@ public function testAddPeriodicTimerWillBeInvokedUntilItIsCancelled()
57
57
58
58
// make no strict assumptions about actual time interval.
59
59
// leave some room to ensure this ticks exactly 3 times.
60
- $ loop ->addTimer (0.399 , function () use ($ loop , $ periodic ) {
60
+ $ loop ->addTimer (0.350 , function () use ($ loop , $ periodic ) {
61
61
$ loop ->cancelTimer ($ periodic );
62
62
});
63
63
@@ -135,7 +135,7 @@ function () use (&$start) {
135
135
$ loop ->run ();
136
136
$ end = \microtime (true );
137
137
138
- // 1ms should be enough even on slow machines
139
- $ this ->assertLessThan (0.001 , $ end - $ start );
138
+ // 1ms should be enough even on slow machines (± 1ms due to timer inaccuracies)
139
+ $ this ->assertLessThan (0.002 , $ end - $ start );
140
140
}
141
141
}
0 commit comments