@@ -64,6 +64,8 @@ public function testCreateClientLocalhostWithDefaultResolver()
6464 $ promise = $ this ->factory ->createClient ('localhost:12345 ' );
6565
6666 $ capturedClient = Block \await ($ promise , $ this ->loop );
67+ $ this ->assertInstanceOf ('React\Datagram\SocketInterface ' , $ capturedClient );
68+
6769 $ capturedClient ->close ();
6870 }
6971
@@ -131,11 +133,13 @@ public function testCreateClientWithHostnameWillUseResolver()
131133 $ client ->close ();
132134 }
133135
136+ /**
137+ * @expectedException RuntimeException
138+ */
134139 public function testCreateClientWithHostnameWillRejectIfResolverRejects ()
135140 {
136141 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ('example.com ' )->willReturn (Promise \reject (new \RuntimeException ('test ' )));
137142
138- $ this ->setExpectedException ('RuntimeException ' );
139143 Block \await ($ this ->factory ->createClient ('example.com:0 ' ), $ this ->loop );
140144 }
141145
@@ -157,6 +161,9 @@ public function testCreateServerWithInvalidHostnameWillReject()
157161 Block \await ($ this ->factory ->createServer ('///// ' ), $ this ->loop );
158162 }
159163
164+ /**
165+ * @expectedException RuntimeException
166+ */
160167 public function testCancelCreateClientWithCancellableHostnameResolver ()
161168 {
162169 $ promise = new Promise \Promise (function () { }, $ this ->expectCallableOnce ());
@@ -165,10 +172,12 @@ public function testCancelCreateClientWithCancellableHostnameResolver()
165172 $ promise = $ this ->factory ->createClient ('example.com:0 ' );
166173 $ promise ->cancel ();
167174
168- $ this ->setExpectedException ('RuntimeException ' );
169175 Block \await ($ promise , $ this ->loop );
170176 }
171177
178+ /**
179+ * @expectedException RuntimeException
180+ */
172181 public function testCancelCreateClientWithUncancellableHostnameResolver ()
173182 {
174183 $ promise = $ this ->getMockBuilder ('React\Promise\PromiseInterface ' )->getMock ();
@@ -177,7 +186,6 @@ public function testCancelCreateClientWithUncancellableHostnameResolver()
177186 $ promise = $ this ->factory ->createClient ('example.com:0 ' );
178187 $ promise ->cancel ();
179188
180- $ this ->setExpectedException ('RuntimeException ' );
181189 Block \await ($ promise , $ this ->loop );
182190 }
183191}
0 commit comments