From 0b30992fbc59eb459cc5c8d62f7b7bfed321d472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Thu, 6 Jul 2023 09:58:33 +0200 Subject: [PATCH] Update test suite to avoid unhandled promise rejections --- tests/CoroutineTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/CoroutineTest.php b/tests/CoroutineTest.php index c9b7439..2c674c5 100644 --- a/tests/CoroutineTest.php +++ b/tests/CoroutineTest.php @@ -193,6 +193,8 @@ public function testCoroutineShouldNotCreateAnyGarbageReferencesForPromiseReject }); }); + $promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection + unset($promise); $this->assertEquals(0, gc_collect_cycles()); @@ -232,6 +234,8 @@ public function testCoroutineShouldNotCreateAnyGarbageReferencesWhenGeneratorThr yield; // @phpstan-ignore-line }); + $promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection + unset($promise); $this->assertEquals(0, gc_collect_cycles()); @@ -249,6 +253,8 @@ public function testCoroutineShouldNotCreateAnyGarbageReferencesWhenGeneratorYie yield 42; }); + $promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection + unset($promise); $this->assertEquals(0, gc_collect_cycles());