File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ matrix:
1818 include :
1919 - php : 5.3
2020 dist : precise
21- include :
2221 - os : osx
2322 language : generic
2423 php : 7.0 # just to look right on travis
Original file line number Diff line number Diff line change @@ -116,6 +116,13 @@ private function waitForStreamOnce($stream)
116116 $ loop ->removeWriteStream ($ stream );
117117 fclose ($ stream );
118118
119+ // @codeCoverageIgnoreStart
120+ // legacy PHP 5.3 sometimes requires a second close call (see tests)
121+ if (PHP_VERSION_ID < 50400 && is_resource ($ stream )) {
122+ fclose ($ stream );
123+ }
124+ // codeCoverageIgnoreEnd
125+
119126 $ resolve = $ reject = $ progress = null ;
120127 throw new RuntimeException ('Cancelled while waiting for TCP/IP connection to be established ' );
121128 });
Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ public function cancellingConnectionShouldRemoveResourceFromLoopAndCloseResource
221221 $ connector = new TcpConnector ($ loop );
222222
223223 $ server = new TcpServer (0 , $ loop );
224+ $ server ->on ('connection ' , $ this ->expectCallableNever ());
224225
225226 $ loop ->expects ($ this ->once ())->method ('addWriteStream ' );
226227 $ promise = $ connector ->connect ($ server ->getAddress ());
@@ -234,7 +235,11 @@ public function cancellingConnectionShouldRemoveResourceFromLoopAndCloseResource
234235 }));
235236 $ promise ->cancel ();
236237
238+ // ensure that this was a valid resource during the removeWriteStream() call
237239 $ this ->assertTrue ($ valid );
240+
241+ // ensure that this resource should now be closed after the cancel() call
242+ $ this ->assertInternalType ('resource ' , $ resource );
238243 $ this ->assertFalse (is_resource ($ resource ));
239244 }
240245
You can’t perform that action at this time.
0 commit comments