Skip to content

Commit acb1cd6

Browse files
authored
Merge pull request #70 from clue-labs/timeouts
Increase test timeouts for HHVM and unify timeout handling
2 parents 018e855 + b946301 commit acb1cd6

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

tests/AbstractLoopTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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()

tests/StreamSelectLoopTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ public function testStreamSelectTimeoutEmulation()
3737
$this->assertGreaterThan(0.04, $interval);
3838
}
3939

40-
public function testStopShouldPreventRunFromBlocking($timeLimit = 0.005)
41-
{
42-
if (defined('HHVM_VERSION')) {
43-
// HHVM is a bit slow, so give it more time
44-
parent::testStopShouldPreventRunFromBlocking(0.5);
45-
} else {
46-
parent::testStopShouldPreventRunFromBlocking($timeLimit);
47-
}
48-
}
49-
50-
5140
public function signalProvider()
5241
{
5342
return [

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy