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()
589
589
$ this ->assertRunFasterThan (1.6 );
590
590
}
591
591
592
- public function testTimerIntervalBelowZeroRunsImmediately ()
593
- {
594
- $ this ->loop ->addTimer (-1 , function () {});
595
-
596
- $ this ->assertRunFasterThan (0.002 );
597
- }
598
-
599
592
public function testTimerIntervalCanBeFarInFuture ()
600
593
{
601
594
// Maximum interval for ExtUvLoop implementation
Original file line number Diff line number Diff line change @@ -137,4 +137,22 @@ public function testMinimumIntervalOneMicrosecond()
137
137
138
138
$ this ->assertEquals (0.000001 , $ timer ->getInterval ());
139
139
}
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
+ }
140
158
}
You can’t perform that action at this time.
0 commit comments