Skip to content

Commit 6911c5b

Browse files
committed
Increase timings for macOS build
1 parent 72fd7e2 commit 6911c5b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

test/AsyncTestCaseTest.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Amp\Promise;
1010
use PHPUnit\Framework\AssertionFailedError;
1111
use function Amp\call;
12+
use function Amp\delay;
1213

1314
class AsyncTestCaseTest extends AsyncTestCase
1415
{
@@ -53,7 +54,7 @@ public function testExpectingAnExceptionThrown(): \Generator
5354
{
5455
$throwException = function () {
5556
return call(function () {
56-
yield new Delayed(100);
57+
yield delay(100);
5758
throw new \Exception('threw the error');
5859
});
5960
};
@@ -117,7 +118,7 @@ public function testReturnValueFromDependentTest(string $value = null)
117118
public function testSetTimeout(): \Generator
118119
{
119120
$this->setTimeout(100);
120-
$this->assertNull(yield new Delayed(50));
121+
$this->assertNull(yield delay(50));
121122
}
122123

123124
public function testSetTimeoutWithCoroutine(): \Generator
@@ -127,7 +128,7 @@ public function testSetTimeoutWithCoroutine(): \Generator
127128
$this->expectException(AssertionFailedError::class);
128129
$this->expectExceptionMessage('Expected test to complete before 100ms time limit');
129130

130-
yield new Delayed(200);
131+
yield delay(200);
131132
}
132133

133134
public function testSetTimeoutWithWatcher()
@@ -142,29 +143,26 @@ public function testSetTimeoutWithWatcher()
142143

143144
public function testSetMinimumRunTime(): \Generator
144145
{
145-
$this->setMinimumRuntime(100);
146-
$func = function () {
147-
yield new Delayed(75);
148-
return 'finished';
149-
};
146+
$this->setMinimumRuntime(1000);
150147

151148
$this->expectException(AssertionFailedError::class);
152-
$pattern = "/Expected test to take at least 100ms but instead took (\d+)ms/";
149+
$pattern = "/Expected test to take at least 1000ms but instead took (\d+)ms/";
153150
if (\method_exists($this, 'expectExceptionMessageMatches')) {
154151
// PHPUnit 8+
155152
$this->expectExceptionMessageMatches($pattern);
156153
} else {
157154
// PHPUnit 6-7
158155
$this->expectExceptionMessageRegExp($pattern);
159156
}
160-
yield call($func);
157+
158+
yield delay(750);
161159
}
162160

163161
public function testSetMinimumRunTimeWithWatchersOnly()
164162
{
165-
$this->setMinimumRuntime(100);
166-
$this->setTimeout(200);
167-
Loop::delay(100, $this->createCallback(1));
163+
$this->setMinimumRuntime(1000);
164+
$this->setTimeout(2000);
165+
Loop::delay(1500, $this->createCallback(1));
168166
}
169167

170168
public function testUnresolvedPromise(): Promise

0 commit comments

Comments
 (0)