@@ -51,6 +51,7 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
5151 public function testServerEmitsConnectionEventForNewConnection ()
5252 {
5353 $ client = stream_socket_client ('tcp://localhost: ' .$ this ->port );
54+ assert ($ client !== false );
5455
5556 $ server = $ this ->server ;
5657 $ promise = new Promise (function ($ resolve ) use ($ server ) {
@@ -70,6 +71,7 @@ public function testConnectionWithManyClients()
7071 $ client1 = stream_socket_client ('tcp://localhost: ' .$ this ->port );
7172 $ client2 = stream_socket_client ('tcp://localhost: ' .$ this ->port );
7273 $ client3 = stream_socket_client ('tcp://localhost: ' .$ this ->port );
74+ assert ($ client1 !== false && $ client2 !== false && $ client3 !== false );
7375
7476 $ this ->server ->on ('connection ' , $ this ->expectCallableExactly (3 ));
7577 $ this ->tick ();
@@ -80,6 +82,7 @@ public function testConnectionWithManyClients()
8082 public function testDataEventWillNotBeEmittedWhenClientSendsNoData ()
8183 {
8284 $ client = stream_socket_client ('tcp://localhost: ' .$ this ->port );
85+ assert ($ client !== false );
8386
8487 $ mock = $ this ->expectCallableNever ();
8588
@@ -150,6 +153,7 @@ public function testGetAddressAfterCloseReturnsNull()
150153 public function testLoopWillEndWhenServerIsClosedAfterSingleConnection ()
151154 {
152155 $ client = stream_socket_client ('tcp://localhost: ' . $ this ->port );
156+ assert ($ client !== false );
153157
154158 // explicitly unset server because we only accept a single connection
155159 // and then already call close()
@@ -203,6 +207,7 @@ public function testDataWillBeEmittedInMultipleChunksWhenClientSendsExcessiveAmo
203207 public function testConnectionDoesNotEndWhenClientDoesNotClose ()
204208 {
205209 $ client = stream_socket_client ('tcp://localhost: ' .$ this ->port );
210+ assert ($ client !== false );
206211
207212 $ mock = $ this ->expectCallableNever ();
208213
@@ -236,7 +241,7 @@ public function testCtorAddsResourceToLoop()
236241 $ loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
237242 $ loop ->expects ($ this ->once ())->method ('addReadStream ' );
238243
239- $ server = new TcpServer (0 , $ loop );
244+ new TcpServer (0 , $ loop );
240245 }
241246
242247 public function testResumeWithoutPauseIsNoOp ()
@@ -316,7 +321,7 @@ public function testEmitsErrorWhenAcceptListenerFails()
316321 public function testEmitsTimeoutErrorWhenAcceptListenerFails (\RuntimeException $ exception )
317322 {
318323 if (defined ('HHVM_VERSION ' )) {
319- $ this ->markTestSkipped ('not supported on HHVM ' );
324+ $ this ->markTestSkipped ('Not supported on HHVM ' );
320325 }
321326
322327 $ this ->assertEquals ('Unable to accept new connection: ' . socket_strerror (SOCKET_ETIMEDOUT ) . ' (ETIMEDOUT) ' , $ exception ->getMessage ());
@@ -328,9 +333,16 @@ public function testListenOnBusyPortThrows()
328333 if (DIRECTORY_SEPARATOR === '\\' ) {
329334 $ this ->markTestSkipped ('Windows supports listening on same port multiple times ' );
330335 }
336+ if (defined ('HHVM_VERSION ' )) {
337+ $ this ->markTestSkipped ('Not supported on HHVM ' );
338+ }
331339
332- $ this ->setExpectedException ('RuntimeException ' );
333- $ another = new TcpServer ($ this ->port , $ this ->loop );
340+ $ this ->setExpectedException (
341+ 'RuntimeException ' ,
342+ 'Failed to listen on "tcp://127.0.0.1: ' . $ this ->port . '": ' . (function_exists ('socket_strerror ' ) ? socket_strerror (SOCKET_EADDRINUSE ) . ' (EADDRINUSE) ' : 'Address already in use ' ),
343+ defined ('SOCKET_EADDRINUSE ' ) ? SOCKET_EADDRINUSE : 0
344+ );
345+ new TcpServer ($ this ->port , $ this ->loop );
334346 }
335347
336348 /**
0 commit comments