@@ -46,17 +46,24 @@ public function queryShouldCreateUdpRequest()
4646 $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
4747 }
4848
49- /** @test */
49+ /**
50+ * @test
51+ * @expectedException RuntimeException
52+ */
5053 public function resolveShouldRejectIfRequestIsLargerThan512Bytes ()
5154 {
5255 $ query = new Query (str_repeat ('a ' , 512 ).'.igor.io ' , Message::TYPE_A , Message::CLASS_IN , 1345656451 );
5356 $ promise = $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
5457
55- $ this ->setExpectedException ( ' RuntimeException ' , 'DNS query for ' . $ query ->name . ' failed: Requested transport "tcp" not available, only UDP is supported in this version ' );
58+ $ this ->expectExceptionMessage ( 'DNS query for ' . $ query ->name . ' failed: Requested transport "tcp" not available, only UDP is supported in this version ' );
5659 Block \await ($ promise , $ this ->loop );
5760 }
5861
59- /** @test */
62+ /**
63+ * @test
64+ * @expectedException React\Dns\Query\CancellationException
65+ * @expectedExceptionMessage DNS query for igor.io has been cancelled
66+ */
6067 public function resolveShouldCloseConnectionWhenCancelled ()
6168 {
6269 $ conn = $ this ->createConnectionMock (false );
@@ -80,11 +87,14 @@ public function resolveShouldCloseConnectionWhenCancelled()
8087
8188 $ promise ->cancel ();
8289
83- $ this ->setExpectedException ('React\Dns\Query\CancellationException ' , 'DNS query for igor.io has been cancelled ' );
8490 Block \await ($ promise , $ this ->loop );
8591 }
8692
87- /** @test */
93+ /**
94+ * @test
95+ * @expectedException React\Dns\Query\CancellationException
96+ * @expectedExceptionMessage DNS query for igor.io has been cancelled
97+ */
8898 public function resolveShouldNotStartOrCancelTimerWhenCancelledWithTimeoutIsNull ()
8999 {
90100 $ this ->loop
@@ -98,7 +108,6 @@ public function resolveShouldNotStartOrCancelTimerWhenCancelledWithTimeoutIsNull
98108
99109 $ promise ->cancel ();
100110
101- $ this ->setExpectedException ('React\Dns\Query\CancellationException ' , 'DNS query for igor.io has been cancelled ' );
102111 Block \await ($ promise , $ this ->loop );
103112 }
104113
@@ -128,7 +137,11 @@ public function resolveShouldRejectIfResponseIsTruncated()
128137 $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
129138 }
130139
131- /** @test */
140+ /**
141+ * @test
142+ * @expectedException RuntimeException
143+ * @expectedExceptionMessage DNS query for igor.io failed: Nope
144+ */
132145 public function resolveShouldFailIfUdpThrow ()
133146 {
134147 $ this ->loop
@@ -149,7 +162,6 @@ public function resolveShouldFailIfUdpThrow()
149162 $ query = new Query ('igor.io ' , Message::TYPE_A , Message::CLASS_IN , 1345656451 );
150163 $ promise = $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
151164
152- $ this ->setExpectedException ('RuntimeException ' , 'DNS query for igor.io failed: Nope ' );
153165 Block \await ($ promise , $ this ->loop );
154166 }
155167
@@ -188,7 +200,11 @@ public function resolveShouldCancelTimerWhenFullResponseIsReceived()
188200 $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
189201 }
190202
191- /** @test */
203+ /**
204+ * @test
205+ * @expectedException React\Dns\Query\TimeoutException
206+ * @expectedExceptionMessage DNS query for igor.io timed out
207+ */
192208 public function resolveShouldCloseConnectionOnTimeout ()
193209 {
194210 $ this ->executor = $ this ->createExecutorMock ();
@@ -218,7 +234,6 @@ public function resolveShouldCloseConnectionOnTimeout()
218234 $ this ->assertNotNull ($ timerCallback );
219235 $ timerCallback ();
220236
221- $ this ->setExpectedException ('React\Dns\Query\TimeoutException ' , 'DNS query for igor.io timed out ' );
222237 Block \await ($ promise , $ this ->loop );
223238 }
224239
0 commit comments