@@ -48,12 +48,12 @@ public function testInitializeWithParams()
48
48
$ this ->assertSame ('1.23 ' , $ this ->request ->getAmount ());
49
49
}
50
50
51
- /**
52
- * @expectedException \Omnipay\Common\Exception\RuntimeException
53
- * @expectedExceptionMessage Request cannot be modified after it has been sent!
54
- */
55
51
public function testInitializeAfterRequestSent ()
56
52
{
53
+ $ this ->expectException (\Omnipay \Common \Exception \RuntimeException::class);
54
+ $ this ->expectExceptionMessage ("Request cannot be modified after it has been sent! " );
55
+
56
+
57
57
$ this ->request = new AbstractRequestTest_MockAbstractRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
58
58
$ this ->request ->send ();
59
59
@@ -120,12 +120,11 @@ public function testAmountZeroString()
120
120
$ this ->assertSame ('0.00 ' , $ this ->request ->getAmount ());
121
121
}
122
122
123
- /**
124
- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
125
- * @expectedExceptionMessage A zero amount is not allowed.
126
- */
127
123
public function testAmountZeroNotAllowed ()
128
124
{
125
+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
126
+ $ this ->expectExceptionMessage ('A zero amount is not allowed. ' );
127
+
129
128
$ this ->changeProtectedProperty ('zeroAmountAllowed ' , false );
130
129
$ this ->request ->setAmount ('0.00 ' );
131
130
$ this ->request ->getAmount ();
@@ -164,13 +163,14 @@ public function testAmountPrecisionLargeNumbers()
164
163
}
165
164
166
165
/**
167
- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
168
166
*
169
167
* We still want to catch obvious fractions of the minor units that are
170
168
* not precision errors at a much lower level.
171
169
*/
172
170
public function testAmountPrecisionTooHigh ()
173
171
{
172
+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
173
+
174
174
$ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('123.005 ' ));
175
175
$ this ->assertSame ('123.005 ' , $ this ->request ->getAmount ());
176
176
}
@@ -182,11 +182,10 @@ public function testGetAmountNoDecimals()
182
182
$ this ->assertSame ('1366 ' , $ this ->request ->getAmount ());
183
183
}
184
184
185
- /**
186
- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
187
- */
188
185
public function testGetAmountNoDecimalsRounding ()
189
186
{
187
+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
188
+
190
189
// There will not be any rounding; the amount is sent as requested or not at all.
191
190
$ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('136.5 ' ));
192
191
$ this ->assertSame ($ this ->request , $ this ->request ->setCurrency ('JPY ' ));
@@ -219,11 +218,10 @@ public function testGetAmountIntegerNoDecimals()
219
218
$ this ->assertSame (1366 , $ this ->request ->getAmountInteger ());
220
219
}
221
220
222
- /**
223
- * @expectedException \InvalidArgumentException
224
- */
225
221
public function testAmountThousandsSepThrowsException ()
226
222
{
223
+ $ this ->expectException (\InvalidArgumentException::class);
224
+
227
225
$ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('1,234.00 ' ));
228
226
$ this ->request ->getAmount ();
229
227
}
@@ -233,24 +231,24 @@ public function testAmountThousandsSepThrowsException()
233
231
*/
234
232
public function testAmountInvalidFormatThrowsException ()
235
233
{
234
+ $ this ->expectException (\InvalidArgumentException::class);
235
+
236
236
$ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('1.234.00 ' ));
237
237
$ this ->request ->getAmount ();
238
238
}
239
239
240
- /**
241
- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
242
- */
243
240
public function testAmountNegativeStringThrowsException ()
244
241
{
242
+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
243
+
245
244
$ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('-123.00 ' ));
246
245
$ this ->request ->getAmount ();
247
246
}
248
247
249
- /**
250
- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
251
- */
252
248
public function testAmountNegativeFloatThrowsException ()
253
249
{
250
+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
251
+
254
252
$ this ->assertSame ($ this ->request , $ this ->request ->setAmount (-123.00 ));
255
253
$ this ->request ->getAmount ();
256
254
}
@@ -423,12 +421,11 @@ public function testGetParameters()
423
421
$ this ->assertEquals ($ expected , $ this ->request ->getParameters ());
424
422
}
425
423
426
- /**
427
- * @expectedException \Omnipay\Common\Exception\RuntimeException
428
- * @expectedExceptionMessage Request cannot be modified after it has been sent!
429
- */
430
424
public function testSetParameterAfterRequestSent ()
431
425
{
426
+ $ this ->expectException (\Omnipay \Common \Exception \RuntimeException::class);
427
+ $ this ->expectExceptionMessage ('Request cannot be modified after it has been sent! ' );
428
+
432
429
$ this ->request = new AbstractRequestTest_MockAbstractRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
433
430
$ this ->request ->send ();
434
431
@@ -450,11 +447,10 @@ public function testCanValidateAmountInteger()
450
447
$ this ->assertNull ($ this ->request ->validate ('amount ' ));
451
448
}
452
449
453
- /**
454
- * @expectedException \Omnipay\Common\Exception\InvalidRequestException
455
- */
456
450
public function testInvalidParametersThrowsException ()
457
451
{
452
+ $ this ->expectException (\Omnipay \Common \Exception \InvalidRequestException::class);
453
+
458
454
$ this ->request ->setTestMode (true );
459
455
460
456
$ this ->request ->validate ('testMode ' , 'token ' );
@@ -477,12 +473,11 @@ public function testSend()
477
473
$ this ->assertSame ($ response , $ this ->request ->send ());
478
474
}
479
475
480
- /**
481
- * @expectedException \Omnipay\Common\Exception\RuntimeException
482
- * @expectedExceptionMessage You must call send() before accessing the Response!
483
- */
484
476
public function testGetResponseBeforeRequestSent ()
485
477
{
478
+ $ this ->expectException (\Omnipay \Common \Exception \RuntimeException::class);
479
+ $ this ->expectExceptionMessage ('You must call send() before accessing the Response! ' );
480
+
486
481
$ this ->request = new AbstractRequestTest_MockAbstractRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
487
482
$ this ->request ->getResponse ();
488
483
}
0 commit comments