File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ matrix:
18
18
include :
19
19
- php : 5.3
20
20
dist : precise
21
- include :
22
21
- os : osx
23
22
language : generic
24
23
php : 7.0 # just to look right on travis
Original file line number Diff line number Diff line change 25
25
"psr-4" : {
26
26
"React\\ Tests\\ Socket\\ " : " tests"
27
27
}
28
+ },
29
+ "config" : {
30
+ "platform" : {
31
+ "php" : " 5.3.29"
32
+ }
28
33
}
29
34
}
Original file line number Diff line number Diff line change @@ -116,6 +116,13 @@ private function waitForStreamOnce($stream)
116
116
$ loop ->removeWriteStream ($ stream );
117
117
fclose ($ stream );
118
118
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
+
119
126
$ resolve = $ reject = $ progress = null ;
120
127
throw new RuntimeException ('Cancelled while waiting for TCP/IP connection to be established ' );
121
128
});
Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ public function cancellingConnectionShouldRemoveResourceFromLoopAndCloseResource
221
221
$ connector = new TcpConnector ($ loop );
222
222
223
223
$ server = new TcpServer (0 , $ loop );
224
+ $ server ->on ('connection ' , $ this ->expectCallableNever ());
224
225
225
226
$ loop ->expects ($ this ->once ())->method ('addWriteStream ' );
226
227
$ promise = $ connector ->connect ($ server ->getAddress ());
@@ -234,7 +235,11 @@ public function cancellingConnectionShouldRemoveResourceFromLoopAndCloseResource
234
235
}));
235
236
$ promise ->cancel ();
236
237
238
+ // ensure that this was a valid resource during the removeWriteStream() call
237
239
$ this ->assertTrue ($ valid );
240
+
241
+ // ensure that this resource should now be closed after the cancel() call
242
+ $ this ->assertInternalType ('resource ' , $ resource );
238
243
$ this ->assertFalse (is_resource ($ resource ));
239
244
}
240
245
You can’t perform that action at this time.
0 commit comments