@@ -52,7 +52,9 @@ public function testRejectedWillNotStartTimer()
5252 {
5353 $ promise = Promise \reject (new \Exception ('reject ' ));
5454
55- Timer \timeout ($ promise , 3 );
55+ $ promise = Timer \timeout ($ promise , 3 );
56+
57+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
5658
5759 $ time = microtime (true );
5860 Loop::run ();
@@ -83,7 +85,9 @@ public function testPendingCancellableWillBeCancelledThroughFollowerOnTimeout()
8385 $ promise = $ this ->getMockBuilder ($ cancellableInterface )->getMock ();
8486 $ promise ->expects ($ this ->once ())->method ('then ' )->willReturn ($ cancellable );
8587
86- Timer \timeout ($ promise , 0.01 );
88+ $ promise = Timer \timeout ($ promise , 0.01 );
89+
90+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
8791
8892 Loop::run ();
8993 }
@@ -210,6 +214,8 @@ public function testWaitingForPromiseToRejectBeforeTimeoutDoesNotLeaveGarbageCyc
210214
211215 $ promise = Timer \timeout ($ promise , 1.0 );
212216
217+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
218+
213219 Loop::run ();
214220 unset($ promise );
215221
@@ -230,6 +236,8 @@ public function testWaitingForPromiseToTimeoutDoesNotLeaveGarbageCycles()
230236
231237 $ promise = Timer \timeout ($ promise , 0.01 );
232238
239+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
240+
233241 Loop::run ();
234242 unset($ promise );
235243
@@ -248,6 +256,8 @@ public function testWaitingForPromiseToTimeoutWithoutCancellerDoesNotLeaveGarbag
248256
249257 $ promise = Timer \timeout ($ promise , 0.01 );
250258
259+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
260+
251261 Loop::run ();
252262 unset($ promise );
253263
@@ -268,6 +278,8 @@ public function testWaitingForPromiseToTimeoutWithNoOpCancellerDoesNotLeaveGarba
268278
269279 $ promise = Timer \timeout ($ promise , 0.01 );
270280
281+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
282+
271283 Loop::run ();
272284 unset($ promise );
273285
0 commit comments