File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -200,11 +200,11 @@ function (Exception $e) use ($uri, $deferred) {
200200
201201 // Exception trace arguments are not available on some PHP 7.4 installs
202202 // @codeCoverageIgnoreStart
203- foreach ($ trace as & $ one ) {
203+ foreach ($ trace as $ ti => $ one ) {
204204 if (isset ($ one ['args ' ])) {
205- foreach ($ one ['args ' ] as & $ arg ) {
205+ foreach ($ one ['args ' ] as $ ai => $ arg ) {
206206 if ($ arg instanceof \Closure) {
207- $ arg = 'Object( ' . \get_class ($ arg ) . ') ' ;
207+ $ trace [ $ ti ][ ' args ' ][ $ ai ] = 'Object( ' . \get_class ($ arg ) . ') ' ;
208208 }
209209 }
210210 }
Original file line number Diff line number Diff line change @@ -173,11 +173,17 @@ public function testConnectorRejectsWillRejectConnection()
173173
174174 $ promise = $ this ->client ->connect ('google.com:80 ' );
175175
176- $ promise ->then (null , $ this ->expectCallableOnceWithException (
177- 'RuntimeException ' ,
178- 'Connection to tcp://google.com:80 failed because connection to proxy failed (ECONNREFUSED) ' ,
179- defined ('SOCKET_ECONNREFUSED ' ) ? SOCKET_ECONNREFUSED : 111
180- ));
176+ $ exception = null ;
177+ $ promise ->then (null , function ($ reason ) use (&$ exception ) {
178+ $ exception = $ reason ;
179+ });
180+
181+ assert ($ exception instanceof \RuntimeException);
182+ $ this ->assertInstanceOf ('RuntimeException ' , $ exception );
183+ $ this ->assertEquals ('Connection to tcp://google.com:80 failed because connection to proxy failed (ECONNREFUSED) ' , $ exception ->getMessage ());
184+ $ this ->assertEquals (defined ('SOCKET_ECONNREFUSED ' ) ? SOCKET_ECONNREFUSED : 111 , $ exception ->getCode ());
185+ $ this ->assertInstanceOf ('RuntimeException ' , $ exception ->getPrevious ());
186+ $ this ->assertNotEquals ('' , $ exception ->getTraceAsString ());
181187 }
182188
183189 public function testCancelConnectionDuringConnectionWillCancelConnection ()
You can’t perform that action at this time.
0 commit comments