3
3
namespace Omnipay \IcepayPayments \Message ;
4
4
5
5
use GuzzleHttp \Psr7 \Request ;
6
+ use Omnipay \Common \Exception \InvalidRequestException ;
6
7
use Omnipay \Common \Http \Client ;
7
8
use Omnipay \IcepayPayments \AbstractTestCase ;
8
9
@@ -34,7 +35,7 @@ protected function setUp(): void
34
35
/**
35
36
* Test a valid request for a refund.
36
37
*/
37
- public function testRefundGetDataWithValidValues ()
38
+ public function testRefundGetDataWithValidValues (): void
38
39
{
39
40
$ expected = [
40
41
'ContractProfileId ' => '1-4M-4-B1G-B1G-G1RL ' ,
@@ -54,7 +55,7 @@ public function testRefundGetDataWithValidValues()
54
55
/**
55
56
* Test actually sending the data to the client.
56
57
*/
57
- public function testSendData ()
58
+ public function testRefundSendDataWithValidRequest (): void
58
59
{
59
60
$ this ->request ->setTransactionReference ('1M-MR-M33533K5-L00K-47-M3 ' );
60
61
$ response = $ this ->request ->sendData ($ this ->request ->getData ());
@@ -69,4 +70,15 @@ public function testSendData()
69
70
$ this ->assertEquals ($ expectedRequest ->getMethod (), $ this ->clientMock ->getLastRequest ()->getMethod ());
70
71
$ this ->assertEquals ($ expectedRequest ->getUri (), $ this ->clientMock ->getLastRequest ()->getUri ());
71
72
}
73
+
74
+ /**
75
+ * Test actually sending the data to the client.
76
+ */
77
+ public function testRefundSendDataWithMissingReference (): void
78
+ {
79
+ $ this ->expectException (InvalidRequestException::class);
80
+
81
+ $ this ->request ->setTransactionReference ('' );
82
+ $ this ->request ->sendData ($ this ->request ->getData ());
83
+ }
72
84
}
0 commit comments