@@ -148,7 +148,10 @@ public function testPingAfterPreviousFactoryRejectsUnderlyingClientWillCreateNew
148148 new Promise (function () { })
149149 );
150150
151- $ this ->redis ->ping ();
151+ $ promise = $ this ->redis ->ping ();
152+
153+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
154+
152155 $ deferred ->reject ($ error );
153156
154157 $ this ->redis ->ping ();
@@ -213,7 +216,7 @@ public function testPingAfterPingWillNotStartIdleTimerWhenFirstPingResolves()
213216
214217 $ this ->redis ->ping ();
215218 $ this ->redis ->ping ();
216- $ deferred ->resolve ();
219+ $ deferred ->resolve (null );
217220 }
218221
219222 public function testPingAfterPingWillStartAndCancelIdleTimerWhenSecondPingStartsAfterFirstResolves ()
@@ -232,15 +235,15 @@ public function testPingAfterPingWillStartAndCancelIdleTimerWhenSecondPingStarts
232235 $ this ->loop ->expects ($ this ->once ())->method ('cancelTimer ' )->with ($ timer );
233236
234237 $ this ->redis ->ping ();
235- $ deferred ->resolve ();
238+ $ deferred ->resolve (null );
236239 $ this ->redis ->ping ();
237240 }
238241
239242 public function testPingFollowedByIdleTimerWillCloseUnderlyingConnectionWithoutCloseEvent ()
240243 {
241244 $ client = $ this ->getMockBuilder ('Clue\React\Redis\Client ' )->getMock ();
242- $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve ());
243- $ client ->expects ($ this ->once ())->method ('close ' )-> willReturn ( \ React \ Promise \resolve ()) ;
245+ $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve (null ));
246+ $ client ->expects ($ this ->once ())->method ('close ' );
244247
245248 $ this ->factory ->expects ($ this ->once ())->method ('createClient ' )->willReturn (\React \Promise \resolve ($ client ));
246249
@@ -295,14 +298,17 @@ public function testCloseAfterPingWillEmitCloseWithoutErrorWhenUnderlyingClientC
295298 $ this ->redis ->on ('error ' , $ this ->expectCallableNever ());
296299 $ this ->redis ->on ('close ' , $ this ->expectCallableOnce ());
297300
298- $ this ->redis ->ping ();
301+ $ promise = $ this ->redis ->ping ();
302+
303+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
304+
299305 $ this ->redis ->close ();
300306 }
301307
302308 public function testCloseAfterPingWillCloseUnderlyingClientConnectionWhenAlreadyResolved ()
303309 {
304310 $ client = $ this ->getMockBuilder ('Clue\React\Redis\Client ' )->getMock ();
305- $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve ());
311+ $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve (null ));
306312 $ client ->expects ($ this ->once ())->method ('close ' );
307313
308314 $ deferred = new Deferred ();
@@ -327,7 +333,7 @@ public function testCloseAfterPingWillCancelIdleTimerWhenPingIsAlreadyResolved()
327333 $ this ->loop ->expects ($ this ->once ())->method ('cancelTimer ' )->with ($ timer );
328334
329335 $ this ->redis ->ping ();
330- $ deferred ->resolve ();
336+ $ deferred ->resolve (null );
331337 $ this ->redis ->close ();
332338 }
333339
@@ -404,7 +410,7 @@ public function testEmitsNoErrorEventWhenUnderlyingClientEmitsError()
404410 $ error = new \RuntimeException ();
405411
406412 $ client = $ this ->getMockBuilder ('Clue\React\Redis\Client ' )->getMock ();
407- $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve ());
413+ $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve (null ));
408414
409415 $ deferred = new Deferred ();
410416 $ this ->factory ->expects ($ this ->once ())->method ('createClient ' )->willReturn ($ deferred ->promise ());
@@ -419,7 +425,7 @@ public function testEmitsNoErrorEventWhenUnderlyingClientEmitsError()
419425 public function testEmitsNoCloseEventWhenUnderlyingClientEmitsClose ()
420426 {
421427 $ client = $ this ->getMockBuilder ('Clue\React\Redis\Client ' )->getMock ();
422- $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve ());
428+ $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve (null ));
423429
424430 $ deferred = new Deferred ();
425431 $ this ->factory ->expects ($ this ->once ())->method ('createClient ' )->willReturn ($ deferred ->promise ());
@@ -453,7 +459,7 @@ public function testEmitsNoCloseEventButWillCancelIdleTimerWhenUnderlyingConnect
453459 $ this ->redis ->on ('close ' , $ this ->expectCallableNever ());
454460
455461 $ this ->redis ->ping ();
456- $ deferred ->resolve ();
462+ $ deferred ->resolve (null );
457463
458464 $ this ->assertTrue (is_callable ($ closeHandler ));
459465 $ closeHandler ();
@@ -463,7 +469,7 @@ public function testEmitsMessageEventWhenUnderlyingClientEmitsMessageForPubSubCh
463469 {
464470 $ messageHandler = null ;
465471 $ client = $ this ->getMockBuilder ('Clue\React\Redis\Client ' )->getMock ();
466- $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve ());
472+ $ client ->expects ($ this ->once ())->method ('__call ' )->willReturn (\React \Promise \resolve (null ));
467473 $ client ->expects ($ this ->any ())->method ('on ' )->willReturnCallback (function ($ event , $ callback ) use (&$ messageHandler ) {
468474 if ($ event === 'message ' ) {
469475 $ messageHandler = $ callback ;
@@ -485,7 +491,7 @@ public function testEmitsUnsubscribeAndPunsubscribeEventsWhenUnderlyingClientClo
485491 {
486492 $ allHandler = null ;
487493 $ client = $ this ->getMockBuilder ('Clue\React\Redis\Client ' )->getMock ();
488- $ client ->expects ($ this ->exactly (6 ))->method ('__call ' )->willReturn (\React \Promise \resolve ());
494+ $ client ->expects ($ this ->exactly (6 ))->method ('__call ' )->willReturn (\React \Promise \resolve (null ));
489495 $ client ->expects ($ this ->any ())->method ('on ' )->willReturnCallback (function ($ event , $ callback ) use (&$ allHandler ) {
490496 if (!isset ($ allHandler [$ event ])) {
491497 $ allHandler [$ event ] = $ callback ;
0 commit comments