File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 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)
256256
257257 // Exception trace arguments are not available on some PHP 7.4 installs
258258 // @codeCoverageIgnoreStart
259- foreach ($ trace as & $ one ) {
259+ foreach ($ trace as $ ti => $ one ) {
260260 if (isset ($ one ['args ' ])) {
261- foreach ($ one ['args ' ] as & $ arg ) {
261+ foreach ($ one ['args ' ] as $ ai => $ arg ) {
262262 if ($ arg instanceof \Closure) {
263- $ arg = 'Object( ' . get_class ($ arg ) . ') ' ;
263+ $ trace [ $ ti ][ ' args ' ][ $ ai ] = 'Object( ' . get_class ($ arg ) . ') ' ;
264264 }
265265 }
266266 }
Original file line number Diff line number Diff line change @@ -302,15 +302,17 @@ public function testRejectsWithPreviousIfConnectorRejects()
302302
303303 $ promise = $ proxy ->connect ('google.com:80 ' );
304304
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+ });
310309
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 ());
314316 }
315317
316318 public function testRejectsAndClosesIfStreamWritesNonHttp ()
You can’t perform that action at this time.
0 commit comments