@@ -48,12 +48,12 @@ public function testInitializeWithParams()
4848 $ this ->assertSame ('1.23 ' , $ this ->request ->getAmount ());
4949 }
5050
51- /**
52- * @expectedException \Omnipay\Common\Exception\RuntimeException
53- * @expectedExceptionMessage Request cannot be modified after it has been sent!
54- */
5551 public function testInitializeAfterRequestSent ()
5652 {
53+ $ this ->expectException (\Omnipay \Common \Exception \RuntimeException::class);
54+ $ this ->expectExceptionMessage ("Request cannot be modified after it has been sent! " );
55+
56+
5757 $ this ->request = new AbstractRequestTest_MockAbstractRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
5858 $ this ->request ->send ();
5959
@@ -120,12 +120,11 @@ public function testAmountZeroString()
120120 $ this ->assertSame ('0.00 ' , $ this ->request ->getAmount ());
121121 }
122122
123- /**
124- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
125- * @expectedExceptionMessage A zero amount is not allowed.
126- */
127123 public function testAmountZeroNotAllowed ()
128124 {
125+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
126+ $ this ->expectExceptionMessage ('A zero amount is not allowed. ' );
127+
129128 $ this ->changeProtectedProperty ('zeroAmountAllowed ' , false );
130129 $ this ->request ->setAmount ('0.00 ' );
131130 $ this ->request ->getAmount ();
@@ -164,13 +163,14 @@ public function testAmountPrecisionLargeNumbers()
164163 }
165164
166165 /**
167- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
168166 *
169167 * We still want to catch obvious fractions of the minor units that are
170168 * not precision errors at a much lower level.
171169 */
172170 public function testAmountPrecisionTooHigh ()
173171 {
172+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
173+
174174 $ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('123.005 ' ));
175175 $ this ->assertSame ('123.005 ' , $ this ->request ->getAmount ());
176176 }
@@ -182,11 +182,10 @@ public function testGetAmountNoDecimals()
182182 $ this ->assertSame ('1366 ' , $ this ->request ->getAmount ());
183183 }
184184
185- /**
186- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
187- */
188185 public function testGetAmountNoDecimalsRounding ()
189186 {
187+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
188+
190189 // There will not be any rounding; the amount is sent as requested or not at all.
191190 $ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('136.5 ' ));
192191 $ this ->assertSame ($ this ->request , $ this ->request ->setCurrency ('JPY ' ));
@@ -219,11 +218,10 @@ public function testGetAmountIntegerNoDecimals()
219218 $ this ->assertSame (1366 , $ this ->request ->getAmountInteger ());
220219 }
221220
222- /**
223- * @expectedException \InvalidArgumentException
224- */
225221 public function testAmountThousandsSepThrowsException ()
226222 {
223+ $ this ->expectException (\InvalidArgumentException::class);
224+
227225 $ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('1,234.00 ' ));
228226 $ this ->request ->getAmount ();
229227 }
@@ -233,24 +231,24 @@ public function testAmountThousandsSepThrowsException()
233231 */
234232 public function testAmountInvalidFormatThrowsException ()
235233 {
234+ $ this ->expectException (\InvalidArgumentException::class);
235+
236236 $ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('1.234.00 ' ));
237237 $ this ->request ->getAmount ();
238238 }
239239
240- /**
241- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
242- */
243240 public function testAmountNegativeStringThrowsException ()
244241 {
242+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
243+
245244 $ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('-123.00 ' ));
246245 $ this ->request ->getAmount ();
247246 }
248247
249- /**
250- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
251- */
252248 public function testAmountNegativeFloatThrowsException ()
253249 {
250+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
251+
254252 $ this ->assertSame ($ this ->request , $ this ->request ->setAmount (-123.00 ));
255253 $ this ->request ->getAmount ();
256254 }
@@ -423,12 +421,11 @@ public function testGetParameters()
423421 $ this ->assertEquals ($ expected , $ this ->request ->getParameters ());
424422 }
425423
426- /**
427- * @expectedException \Omnipay\Common\Exception\RuntimeException
428- * @expectedExceptionMessage Request cannot be modified after it has been sent!
429- */
430424 public function testSetParameterAfterRequestSent ()
431425 {
426+ $ this ->expectException (\Omnipay \Common \Exception \RuntimeException::class);
427+ $ this ->expectExceptionMessage ('Request cannot be modified after it has been sent! ' );
428+
432429 $ this ->request = new AbstractRequestTest_MockAbstractRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
433430 $ this ->request ->send ();
434431
@@ -450,11 +447,10 @@ public function testCanValidateAmountInteger()
450447 $ this ->assertNull ($ this ->request ->validate ('amount ' ));
451448 }
452449
453- /**
454- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
455- */
456450 public function testInvalidParametersThrowsException ()
457451 {
452+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
453+
458454 $ this ->request ->setTestMode (true );
459455
460456 $ this ->request ->validate ('testMode ' , 'token ' );
@@ -477,12 +473,11 @@ public function testSend()
477473 $ this ->assertSame ($ response , $ this ->request ->send ());
478474 }
479475
480- /**
481- * @expectedException \Omnipay\Common\Exception\RuntimeException
482- * @expectedExceptionMessage You must call send() before accessing the Response!
483- */
484476 public function testGetResponseBeforeRequestSent ()
485477 {
478+ $ this ->expectException (\Omnipay \Common \Exception \RuntimeException::class);
479+ $ this ->expectExceptionMessage ('You must call send() before accessing the Response! ' );
480+
486481 $ this ->request = new AbstractRequestTest_MockAbstractRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
487482 $ this ->request ->getResponse ();
488483 }
0 commit comments