@@ -22,9 +22,6 @@ public function testAddTimerReturnsNonPeriodicTimerInstance()
2222 $ this ->assertFalse ($ timer ->isPeriodic ());
2323 }
2424
25- /**
26- * @depends testPlatformHasHighAccuracy
27- */
2825 public function testAddTimerWillBeInvokedOnceAndBlocksLoopWhenRunning ()
2926 {
3027 // Make no strict assumptions about actual time interval. Common
@@ -46,14 +43,15 @@ public function testAddTimerWillBeInvokedOnceAndBlocksLoopWhenRunning()
4643
4744 $ loop = $ this ->createLoop ();
4845
49- $ loop ->addTimer (0.001 , $ this ->expectCallableOnce ());
46+ $ loop ->addTimer (0.002 , $ this ->expectCallableOnce ());
5047
5148 $ start = microtime (true );
5249 $ loop ->run ();
5350 $ end = microtime (true );
5451
52+ // 1 invocation should take 2ms (± 1ms due to timer inaccuracies)
5553 $ this ->assertGreaterThanOrEqual (0.001 , $ end - $ start );
56- $ this ->assertLessThan (0.002 , $ end - $ start );
54+ $ this ->assertLessThan (0.003 , $ end - $ start );
5755 }
5856
5957 public function testAddPeriodicTimerReturnsPeriodicTimerInstance ()
@@ -122,10 +120,10 @@ public function testAddPeriodicTimerCancelsItself()
122120
123121 $ this ->assertEquals (5 , $ i );
124122
125- // make no strict assumptions about time interval.
126- // 5 invocations must take at least 0.005s (5ms) and should not take
127- // longer than 0.1s for slower loops.
128- $ this ->assertGreaterThanOrEqual (0.005 , $ end - $ start );
123+ // 5 invocations should take 5ms (± 1ms due to timer inaccuracies)
124+ // make no strict assumptions about time interval, must at least take 4ms
125+ // and should not take longer than 0.1s for slower loops.
126+ $ this ->assertGreaterThanOrEqual (0.004 , $ end - $ start );
129127 $ this ->assertLessThan (0.1 , $ end - $ start );
130128 }
131129
0 commit comments