@@ -52,7 +52,9 @@ public function testRejectedWillNotStartTimer()
52
52
{
53
53
$ promise = Promise \reject (new \Exception ('reject ' ));
54
54
55
- Timer \timeout ($ promise , 3 );
55
+ $ promise = Timer \timeout ($ promise , 3 );
56
+
57
+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
56
58
57
59
$ time = microtime (true );
58
60
Loop::run ();
@@ -83,7 +85,9 @@ public function testPendingCancellableWillBeCancelledThroughFollowerOnTimeout()
83
85
$ promise = $ this ->getMockBuilder ($ cancellableInterface )->getMock ();
84
86
$ promise ->expects ($ this ->once ())->method ('then ' )->willReturn ($ cancellable );
85
87
86
- Timer \timeout ($ promise , 0.01 );
88
+ $ promise = Timer \timeout ($ promise , 0.01 );
89
+
90
+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
87
91
88
92
Loop::run ();
89
93
}
@@ -210,6 +214,8 @@ public function testWaitingForPromiseToRejectBeforeTimeoutDoesNotLeaveGarbageCyc
210
214
211
215
$ promise = Timer \timeout ($ promise , 1.0 );
212
216
217
+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
218
+
213
219
Loop::run ();
214
220
unset($ promise );
215
221
@@ -230,6 +236,8 @@ public function testWaitingForPromiseToTimeoutDoesNotLeaveGarbageCycles()
230
236
231
237
$ promise = Timer \timeout ($ promise , 0.01 );
232
238
239
+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
240
+
233
241
Loop::run ();
234
242
unset($ promise );
235
243
@@ -248,6 +256,8 @@ public function testWaitingForPromiseToTimeoutWithoutCancellerDoesNotLeaveGarbag
248
256
249
257
$ promise = Timer \timeout ($ promise , 0.01 );
250
258
259
+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
260
+
251
261
Loop::run ();
252
262
unset($ promise );
253
263
@@ -268,6 +278,8 @@ public function testWaitingForPromiseToTimeoutWithNoOpCancellerDoesNotLeaveGarba
268
278
269
279
$ promise = Timer \timeout ($ promise , 0.01 );
270
280
281
+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
282
+
271
283
Loop::run ();
272
284
unset($ promise );
273
285
0 commit comments