File tree 2 files changed +13
-11
lines changed 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -256,11 +256,11 @@ public function connect($uri)
256
256
257
257
// Exception trace arguments are not available on some PHP 7.4 installs
258
258
// @codeCoverageIgnoreStart
259
- foreach ($ trace as & $ one ) {
259
+ foreach ($ trace as $ ti => $ one ) {
260
260
if (isset ($ one ['args ' ])) {
261
- foreach ($ one ['args ' ] as & $ arg ) {
261
+ foreach ($ one ['args ' ] as $ ai => $ arg ) {
262
262
if ($ arg instanceof \Closure) {
263
- $ arg = 'Object( ' . get_class ($ arg ) . ') ' ;
263
+ $ trace [ $ ti ][ ' args ' ][ $ ai ] = 'Object( ' . get_class ($ arg ) . ') ' ;
264
264
}
265
265
}
266
266
}
Original file line number Diff line number Diff line change @@ -302,15 +302,17 @@ public function testRejectsWithPreviousIfConnectorRejects()
302
302
303
303
$ promise = $ proxy ->connect ('google.com:80 ' );
304
304
305
- $ promise ->then (null , $ this ->expectCallableOnceWithException (
306
- 'RuntimeException ' ,
307
- 'Connection to tcp://google.com:80 failed because connection to proxy failed (ECONNREFUSED) ' ,
308
- defined ('SOCKET_ECONNREFUSED ' ) ? SOCKET_ECONNREFUSED : 111
309
- ));
305
+ $ exception = null ;
306
+ $ promise ->then (null , function ($ reason ) use (&$ exception ) {
307
+ $ exception = $ reason ;
308
+ });
310
309
311
- $ promise ->then (null , $ this ->expectCallableOnceWith ($ this ->callback (function (\Exception $ e ) use ($ previous ) {
312
- return $ e ->getPrevious () === $ previous ;
313
- })));
310
+ assert ($ exception instanceof \RuntimeException);
311
+ $ this ->assertInstanceOf ('RuntimeException ' , $ exception );
312
+ $ this ->assertEquals ('Connection to tcp://google.com:80 failed because connection to proxy failed (ECONNREFUSED) ' , $ exception ->getMessage ());
313
+ $ this ->assertEquals (defined ('SOCKET_ECONNREFUSED ' ) ? SOCKET_ECONNREFUSED : 111 , $ exception ->getCode ());
314
+ $ this ->assertSame ($ previous , $ exception ->getPrevious ());
315
+ $ this ->assertNotEquals ('' , $ exception ->getTraceAsString ());
314
316
}
315
317
316
318
public function testRejectsAndClosesIfStreamWritesNonHttp ()
You can’t perform that action at this time.
0 commit comments