@@ -64,7 +64,7 @@ public function testConnectionWithManyClients()
6464 * @covers React\EventLoop\StreamSelectLoop::tick
6565 * @covers React\Socket\Connection::handleData
6666 */
67- public function testDataWithNoData ()
67+ public function testDataEventWillNotBeEmittedWhenClientSendsNoData ()
6868 {
6969 $ client = stream_socket_client ('tcp://localhost: ' .$ this ->port );
7070
@@ -81,17 +81,13 @@ public function testDataWithNoData()
8181 * @covers React\EventLoop\StreamSelectLoop::tick
8282 * @covers React\Socket\Connection::handleData
8383 */
84- public function testData ()
84+ public function testDataWillBeEmittedWithDataClientSends ()
8585 {
8686 $ client = stream_socket_client ('tcp://localhost: ' .$ this ->port );
8787
8888 fwrite ($ client , "foo \n" );
8989
90- $ mock = $ this ->createCallableMock ();
91- $ mock
92- ->expects ($ this ->once ())
93- ->method ('__invoke ' )
94- ->with ("foo \n" );
90+ $ mock = $ this ->expectCallableOnceWith ("foo \n" );
9591
9692 $ this ->server ->on ('connection ' , function ($ conn ) use ($ mock ) {
9793 $ conn ->on ('data ' , $ mock );
@@ -101,23 +97,16 @@ public function testData()
10197 }
10298
10399 /**
104- * Test data sent from python language
105- *
106100 * @covers React\EventLoop\StreamSelectLoop::tick
107101 * @covers React\Socket\Connection::handleData
108102 */
109- public function testDataSentFromPy ()
103+ public function testDataWillBeEmittedEvenWhenClientShutsDownAfterSending ()
110104 {
111105 $ client = stream_socket_client ('tcp://localhost: ' . $ this ->port );
112106 fwrite ($ client , "foo \n" );
113107 stream_socket_shutdown ($ client , STREAM_SHUT_WR );
114108
115- $ mock = $ this ->createCallableMock ();
116- $ mock
117- ->expects ($ this ->once ())
118- ->method ('__invoke ' )
119- ->with ("foo \n" );
120-
109+ $ mock = $ this ->expectCallableOnceWith ("foo \n" );
121110
122111 $ this ->server ->on ('connection ' , function ($ conn ) use ($ mock ) {
123112 $ conn ->on ('data ' , $ mock );
@@ -126,17 +115,13 @@ public function testDataSentFromPy()
126115 $ this ->loop ->tick ();
127116 }
128117
129- public function testFragmentedMessage ()
118+ public function testDataWillBeFragmentedToBufferSize ()
130119 {
131120 $ client = stream_socket_client ('tcp://localhost: ' . $ this ->port );
132121
133122 fwrite ($ client , "Hello World! \n" );
134123
135- $ mock = $ this ->createCallableMock ();
136- $ mock
137- ->expects ($ this ->once ())
138- ->method ('__invoke ' )
139- ->with ("He " );
124+ $ mock = $ this ->expectCallableOnceWith ("He " );
140125
141126 $ this ->server ->on ('connection ' , function ($ conn ) use ($ mock ) {
142127 $ conn ->bufferSize = 2 ;
@@ -149,7 +134,7 @@ public function testFragmentedMessage()
149134 /**
150135 * @covers React\EventLoop\StreamSelectLoop::tick
151136 */
152- public function testDisconnectWithoutDisconnect ()
137+ public function testConnectionDoesNotEndWhenClientDoesNotClose ()
153138 {
154139 $ client = stream_socket_client ('tcp://localhost: ' .$ this ->port );
155140
@@ -166,7 +151,7 @@ public function testDisconnectWithoutDisconnect()
166151 * @covers React\EventLoop\StreamSelectLoop::tick
167152 * @covers React\Socket\Connection::end
168153 */
169- public function testDisconnect ()
154+ public function testConnectionDoesEndWhenClientCloses ()
170155 {
171156 $ client = stream_socket_client ('tcp://localhost: ' .$ this ->port );
172157
0 commit comments