File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -589,13 +589,6 @@ public function testSignalsKeepTheLoopRunningAndRemovingItStopsTheLoop()
589589 $ this ->assertRunFast
8000
erThan (1.6 );
590590 }
591591
592- public function testTimerIntervalBelowZeroRunsImmediately ()
593- {
594- $ this ->loop ->addTimer (-1 , function () {});
595-
596- $ this ->assertRunFasterThan (0.002 );
597- }
598-
599592 public function testTimerIntervalCanBeFarInFuture ()
600593 {
601594 // Maximum interval for ExtUvLoop implementation
Original file line number Diff line number Diff line change @@ -137,4 +137,22 @@ public function testMinimumIntervalOneMicrosecond()
137137
138138 $ this ->assertEquals (0.000001 , $ timer ->getInterval ());
139139 }
140+
141+ public function testTimerIntervalBelowZeroRunsImmediately ()
142+ {
143+ $ loop = $ this ->createLoop ();
144+ $ start = 0 ;
145+ $ loop ->addTimer (
146+ -1 ,
147+ static function () use (&$ start ) {
148+ $ start = \microtime (true );
149+ }
150+ );
151+
152+ $ loop ->run ();
153+ $ end = \microtime (true );
154+
155+ // 1ms should be enough even on slow machines
156+ $ this ->assertLessThan (0.001 , $ end - $ start );
157+ }
140158}
You can’t perform that action at this time.
0 commit comments