Skip to content

Commit 037cbf2

Browse files
authored
Merge pull request #80 from clue-labs/unhandled-rejections-v3
[3.x] Update test suite to avoid unhandled promise rejections
2 parents b51cc55 + 0b30992 commit 037cbf2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/CoroutineTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ public function testCoroutineShouldNotCreateAnyGarbageReferencesForPromiseReject
193193
});
194194
});
195195

196+
$promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection
197+
196198
unset($promise);
197199

198200
$this->assertEquals(0, gc_collect_cycles());
@@ -232,6 +234,8 @@ public function testCoroutineShouldNotCreateAnyGarbageReferencesWhenGeneratorThr
232234
yield; // @phpstan-ignore-line
233235
});
234236

237+
$promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection
238+
235239
unset($promise);
236240

237241
$this->assertEquals(0, gc_collect_cycles());
@@ -249,6 +253,8 @@ public function testCoroutineShouldNotCreateAnyGarbageReferencesWhenGeneratorYie
249253
yield 42;
250254
});
251255

256+
$promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection
257+
252258
unset($promise);
253259

254260
$this->assertEquals(0, gc_collect_cycles());

0 commit comments

Comments
 (0)