3
3
namespace Omnipay \PayPal \Message ;
4
4
5
5
use Omnipay \Common \CreditCard ;
6
+ use Omnipay \Common \Exception \InvalidRequestException ;
6
7
use Omnipay \PayPal \Message \ExpressAuthorizeRequest ;
7
8
use Omnipay \PayPal \Support \InstantUpdateApi \BillingAgreement ;
8
9
use Omnipay \PayPal \Support \InstantUpdateApi \ShippingOption ;
@@ -306,10 +307,8 @@ public function testDataWithCallbackAndNoDefaultShippingOption()
306
307
'shippingOptions ' => $ shippingOptions ,
307
308
)));
308
309
309
- $ this ->setExpectedException (
310
- '\Omnipay\Common\Exception\InvalidRequestException ' ,
311
- 'One of the supplied shipping options must be set as default '
312
- );
310
+ $ this ->expectException (InvalidRequestException::class);
311
+ $ this ->expectExceptionMessage ('One of the supplied shipping options must be set as default ' );
313
312
314
313
$ this ->request ->getData ();
315
314
}
@@ -321,10 +320,8 @@ public function testNoAmount()
321
320
322
321
$ this ->request ->initialize ($ baseData );
323
322
324
- $ this ->setExpectedException (
325
- '\Omnipay\Common\Exception\InvalidRequestException ' ,
326
- 'The amount parameter is required '
327
- );
323
+ $ this ->expectException (InvalidRequestException::class);
324
+ $ this ->expectExceptionMessage ('The amount parameter is required ' );
328
325
329
326
$ this ->request ->getData ();
330
327
}
@@ -337,10 +334,8 @@ public function testAmountButNoReturnUrl()
337
334
338
335
$ this ->request ->initialize ($ baseData );
339
336
340
- $ this ->setExpectedException (
341
- '\Omnipay\Common\Exception\InvalidRequestException ' ,
342
- 'The returnUrl parameter is required '
343
- );
337
+ $ this ->expectException (InvalidRequestException::class);
338
+ $ this ->expectExceptionMessage ('The returnUrl parameter is required ' );
344
339
345
340
$ this ->request ->getData ();
346
341
}
@@ -368,7 +363,7 @@ public function testBadCallbackConfiguration()
368
363
// from the docblock on this exception -
369
364
// Thrown when a request is invalid or missing required fields.
370
365
// callback has been set but no shipping options so expect one of these:
371
- $ this ->setExpectedException ( ' \Omnipay\Common\Exception\ InvalidRequestException' );
366
+ $ this ->expectException ( InvalidRequestException::class );
372
367
373
368
$ this ->request ->getData ();
374
369
}
@@ -413,10 +408,8 @@ public function testGetDataWithBillingAgreementOptionalParameters()
413
408
*/
414
409
public function testGetDataWithBillingAgreementWrongPaymentType ()
415
410
{
416
- $ this ->setExpectedException (
417
- '\Omnipay\Common\Exception\InvalidRequestException ' ,
418
- "The 'paymentType' parameter can be only 'Any' or 'InstantOnly' "
419
- );
411
+ $ this ->expectException (InvalidRequestException::class);
412
+ $ this ->expectExceptionMessage ("The 'paymentType' parameter can be only 'Any' or 'InstantOnly' " );
420
413
421
414
$ billingAgreement = new BillingAgreement (false , 'Some Stuff ' , 'BadType ' , 'Some custom annotation ' );
422
415
}
0 commit comments