@@ -148,7 +148,10 @@ public function testPingAfterPreviousFactoryRejectsUnderlyingClientWillCreateNew
148
148
new Promise (function () { })
149
149
);
150
150
151
- $ this ->redis ->ping ();
151
+ $ promise = $ this ->redis ->ping ();
152
+
153
+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
154
+
152
155
$ deferred ->reject ($ error );
153
156
154
157
$ this ->redis ->ping ();
@@ -213,7 +216,7 @@ public function testPingAfterPingWillNotStartIdleTimerWhenFirstPingResolves()
213
216
214
217
$ this ->redis ->ping ();
215
218
$ this ->redis ->ping ();
216
- $ deferred ->resolve ();
219
+ $ deferred ->resolve (null );
217
220
}
218
221
219
222
public function testPingAfterPingWillStartAndCancelIdleTimerWhenSecondPingStartsAfterFirstResolves ()
@@ -232,15 +235,15 @@ public function testPingAfterPingWillStartAndCancelIdleTimerWhenSecondPingStarts
232
235
$ this ->loop ->expects ($ this ->once ())->method ('cancelTimer ' )->with ($ timer );
233
236
234
237
$ this ->redis ->ping ();
235
- $ deferred ->resolve ();
238
+ $ deferred ->resolve (null );
236
239
$ this ->redis ->ping ();
237
240
}
238
241
239
242
public function testPingFollowedByIdleTimerWillCloseUnderlyingConnectionWithoutCloseEvent ()
240
243
{
241
244
$ 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 ' );
244
247
245
248
$ this ->factory ->expects ($ this ->once ())->method ('createClient ' )->willReturn (\React \Promise \resolve ($ client ));
246
249
@@ -295,14 +298,17 @@ public function testCloseAfterPingWillEmitCloseWithoutErrorWhenUnderlyingClientC
295
298
$ this ->redis ->on ('error ' , $ this ->expectCallableNever ());
296
299
$ this ->redis ->on ('close ' , $ this ->expectCallableOnce ());
297
300
298
- $ this ->redis ->ping ();
301
+ $ promise = $ this ->redis ->ping ();
302
+
303
+ $ promise ->then (null , $ this ->expectCallableOnce ()); // avoid reporting unhandled rejection
304
+
299
305
$ this ->redis ->close ();
300
306
}
301
307
302
308
public function testCloseAfterPingWillCloseUnderlyingClientConnectionWhenAlreadyResolved ()
303
309
{
304
310
$ 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 ));
306
312
$ client ->expects ($ this ->once ())->method ('close ' );
307
313
308
314
$ deferred = new Deferred ();
@@ -327,7 +333,7 @@ public function testCloseAfterPingWillCancelIdleTimerWhenPingIsAlreadyResolved()
327
333
$ this ->loop ->expects ($ this ->once ())->method ('cancelTimer ' )->with ($ timer );
328
334
329
335
$ this ->redis ->ping ();
330
- $ deferred ->resolve ();
336
+ $ deferred ->resolve (null );
331
337
$ this ->redis ->close ();
332
338
}
333
339
@@ -404,7 +410,7 @@ public function testEmitsNoErrorEventWhenUnderlyingClientEmitsError()
404
410
$ error = new \RuntimeException ();
405
411
406
412
$ 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 ));
408
414
409
415
$ deferred = new Deferred ();
410
416
$ this ->factory ->expects ($ this ->once ())->method ('createClient ' )->willReturn ($ deferred ->promise ());
@@ -419,7 +425,7 @@ public function testEmitsNoErrorEventWhenUnderlyingClientEmitsError()
419
425
public function testEmitsNoCloseEventWhenUnderlyingClientEmitsClose ()
420
426
{
421
427
$ 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 ));
423
429
424
430
$ deferred = new Deferred ();
425
431
$ this ->factory ->expects ($ this ->once ())->method ('createClient ' )->willReturn ($ deferred ->promise ());
@@ -453,7 +459,7 @@ public function testEmitsNoCloseEventButWillCancelIdleTimerWhenUnderlyingConnect
453
459
$ this ->redis ->on ('close ' , $ this ->expectCallableNever ());
454
460
455
461
$ this ->redis ->ping ();
456
- $ deferred ->resolve ();
462
+ $ deferred ->resolve (null );
457
463
458
464
$ this ->assertTrue (is_callable ($ closeHandler ));
459
465
$ closeHandler ();
@@ -463,7 +469,7 @@ public function testEmitsMessageEventWhenUnderlyingClientEmitsMessageForPubSubCh
463
469
{
464
470
$ messageHandler = null ;
465
471
$ 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 ));
467
473
$ client ->expects ($ this ->any ())->method ('on ' )->willReturnCallback (function ($ event , $ callback ) use (&$ messageHandler ) {
468
474
if ($ event === 'message ' ) {
469
475
$ messageHandler = $ callback ;
@@ -485,7 +491,7 @@ public function testEmitsUnsubscribeAndPunsubscribeEventsWhenUnderlyingClientClo
485
491
{
486
492
$ allHandler = null ;
487
493
$ 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 ));
489
495
$ client ->expects ($ this ->any ())->method ('on ' )->willReturnCallback (function ($ event , $ callback ) use (&$ allHandler ) {
490
496
if (!isset ($ allHandler [$ event ])) {
491
497
$ allHandler [$ event ] = $ callback ;
0 commit comments