@@ -9,8 +9,12 @@ abstract class AbstractLoopTest extends TestCase
99 */
1010 protected $ loop ;
1111
12+ private $ tickTimeout ;
13+
1214 public function setUp ()
1315 {
16+ // HHVM is a bit slow, so give it more time
17+ $ this ->tickTimeout = defined ('HHVM_VERSION ' ) ? 0.02 : 0.005 ;
1418 $ this ->loop = $ this ->createLoop ();
1519 }
1620
@@ -161,7 +165,7 @@ public function testRemoveInvalid()
161165 /** @test */
162166 public function emptyRunShouldSimplyReturn ()
163167 {
164- $ this ->assertRunFasterThan (0.005 );
168+ $ this ->assertRunFasterThan ($ this -> tickTimeout );
165169 }
166170
167171 /** @test */
@@ -176,7 +180,7 @@ public function runShouldReturnWhenNoMoreFds()
176180
177181 $ this ->writeToStream ($ input , "foo \n" );
178182
179- $ this ->assertRunFasterThan (0.015 );
183+ $ this ->assertRunFasterThan ($ this -> tickTimeout * 2 );
180184 }
181185
182186 /** @test */
@@ -191,10 +195,10 @@ public function stopShouldStopRunningLoop()
191195
192196 $ this ->writeToStream ($ input , "foo \n" );
193197
194- $ this ->assertRunFasterThan (0.005 );
198+ $ this ->assertRunFasterThan ($ this -> tickTimeout * 2 );
195199 }
196200
197- public function testStopShouldPreventRunFromBlocking ($ timeLimit = 0.005 )
201+ public function testStopShouldPreventRunFromBlocking ()
198202 {
199203 $ this ->loop ->addTimer (
200204 1 ,
@@ -209,7 +213,7 @@ function () {
209213 }
210214 );
211215
212- $ this ->assertRunFasterThan ($ timeLimit );
216+ $ this ->assertRunFasterThan ($ this -> tickTimeout * 2 );
213217 }
214218
215219 public function testIgnoreRemovedCallback ()
0 commit comments