@@ -46,24 +46,17 @@ public function queryShouldCreateUdpRequest()
4646 $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
4747 }
4848
49- /**
50- * @test
51- * @expectedException RuntimeException
52- */
49+ /** @test */
5350 public function resolveShouldRejectIfRequestIsLargerThan512Bytes ()
5451 {
5552 $ query = new Query (str_repeat ('a ' , 512 ).'.igor.io ' , Message::TYPE_A , Message::CLASS_IN , 1345656451 );
5653 $ promise = $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
5754
58- $ this ->expectExceptionMessage ( 'DNS query for ' . $ query ->name . ' failed: Requested transport "tcp" not available, only UDP is supported in this version ' );
55+ $ this ->setExpectedException ( ' RuntimeException ' , 'DNS query for ' . $ query ->name . ' failed: Requested transport "tcp" not available, only UDP is supported in this version ' );
5956 Block \await ($ promise , $ this ->loop );
6057 }
6158
62- /**
63- * @test
64- * @expectedException React\Dns\Query\CancellationException
65- * @expectedExceptionMessage DNS query for igor.io has been cancelled
66- */
59+ /** @test */
6760 public function resolveShouldCloseConnectionWhenCancelled ()
6861 {
6962 $ conn = $ this ->createConnectionMock (false );
@@ -87,14 +80,11 @@ public function resolveShouldCloseConnectionWhenCancelled()
8780
8881 $ promise ->cancel ();
8982
83+ $ this ->setExpectedException ('React\Dns\Query\CancellationException ' , 'DNS query for igor.io has been cancelled ' );
9084 Block \await ($ promise , $ this ->loop );
9185 }
9286
93- /**
94- * @test
95- * @expectedException React\Dns\Query\CancellationException
96- * @expectedExceptionMessage DNS query for igor.io has been cancelled
97- */
87+ /** @test */
9888 public function resolveShouldNotStartOrCancelTimerWhenCancelledWithTimeoutIsNull ()
9989 {
10090 $ this ->loop
@@ -108,6 +98,7 @@ public function resolveShouldNotStartOrCancelTimerWhenCancelledWithTimeoutIsNull
10898
10999 $ promise ->cancel ();
110100
101+ $ this ->setExpectedException ('React\Dns\Query\CancellationException ' , 'DNS query for igor.io has been cancelled ' );
111102 Block \await ($ promise , $ this ->loop );
112103 }
113104
@@ -137,11 +128,7 @@ public function resolveShouldRejectIfResponseIsTruncated()
137128 $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
138129 }
139130
140- /**
141- * @test
142- * @expectedException RuntimeException
143- * @expectedExceptionMessage DNS query for igor.io failed: Nope
144- */
131+ /** @test */
145132 public function resolveShouldFailIfUdpThrow ()
146133 {
147134 $ this ->loop
@@ -162,6 +149,7 @@ public function resolveShouldFailIfUdpThrow()
162149 $ query = new Query ('igor.io ' , Message::TYPE_A , Message::CLASS_IN , 1345656451 );
163150 $ promise = $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
164151
152+ $ this ->setExpectedException ('RuntimeException ' , 'DNS query for igor.io failed: Nope ' );
165153 Block \await ($ promise , $ this ->loop );
166154 }
167155
@@ -200,11 +188,7 @@ public function resolveShouldCancelTimerWhenFullResponseIsReceived()
200188 $ this ->executor ->query ('8.8.8.8:53 ' , $ query );
201189 }
202190
203- /**
204- * @test
205- * @expectedException React\Dns\Query\TimeoutException
206- * @expectedExceptionMessage DNS query for igor.io timed out
207- */
191+ /** @test */
208192 public function resolveShouldCloseConnectionOnTimeout ()
209193 {
210194 $ this ->executor = $ this ->createExecutorMock ();
@@ -234,6 +218,7 @@ public function resolveShouldCloseConnectionOnTimeout()
234218 $ this ->assertNotNull ($ timerCallback );
235219 $ timerCallback ();
236220
221+ $ this ->setExpectedException ('React\Dns\Query\TimeoutException ' , 'DNS query for igor.io timed out ' );
237222 Block \await ($ promise , $ this ->loop );
238223 }
239224
0 commit comments