@@ -9,8 +9,12 @@ abstract class AbstractLoopTest extends TestCase
9
9
*/
10
10
protected $ loop ;
11
11
12
+ private $ tickTimeout ;
13
+
12
14
public function setUp ()
13
15
{
16
+ // HHVM is a bit slow, so give it more time
17
+ $ this ->tickTimeout = defined ('HHVM_VERSION ' ) ? 0.02 : 0.005 ;
14
18
$ this ->loop = $ this ->createLoop ();
15
19
}
16
20
@@ -161,7 +165,7 @@ public function testRemoveInvalid()
161
165
/** @test */
162
166
public function emptyRunShouldSimplyReturn ()
163
167
{
164
- $ this ->assertRunFasterThan (0.005 );
168
+ $ this ->assertRunFasterThan ($ this -> tickTimeout );
165
169
}
166
170
167
171
/** @test */
@@ -176,7 +180,7 @@ public function runShouldReturnWhenNoMoreFds()
176
180
177
181
$ this ->writeToStream ($ input , "foo \n" );
178
182
179
- $ this ->assertRunFasterThan (0.015 );
183
+ $ this ->assertRunFasterThan ($ this -> tickTimeout * 2 );
180
184
}
181
185
182
186
/** @test */
@@ -191,10 +195,10 @@ public function stopShouldStopRunningLoop()
191
195
192
196
$ this ->writeToStream ($ input , "foo \n" );
193
197
194
- $ this ->assertRunFasterThan (0.005 );
198
+ $ this ->assertRunFasterThan ($ this -> tickTimeout * 2 );
195
199
}
196
200
197
- public function testStopShouldPreventRunFromBlocking ($ timeLimit = 0.005 )
201
+ public function testStopShouldPreventRunFromBlocking ()
198
202
{
199
203
$ this ->loop ->addTimer (
200
204
1 ,
@@ -209,7 +213,7 @@ function () {
209
213
}
210
214
);
211
215
212
- $ this ->assertRunFasterThan ($ timeLimit );
216
+ $ this ->assertRunFasterThan ($ this -> tickTimeout * 2 );
213
217
}
214
218
215
219
public function testIgnoreRemovedCallback ()
0 commit comments