@@ -16,6 +16,11 @@ class ExpressGatewayTest extends GatewayTestCase
16
16
*/
17
17
protected $ options ;
18
18
19
+ /**
20
+ * @var array
21
+ */
22
+ protected $ voidOptions ;
23
+
19
24
public function setUp ()
20
25
{
21
26
parent ::setUp ();
@@ -27,6 +32,9 @@ public function setUp()
27
32
'returnUrl ' => 'https://www.example.com/return ' ,
28
33
'cancelUrl ' => 'https://www.example.com/cancel ' ,
29
34
);
35
+ $ this ->voidOptions = array (
36
+ 'transactionReference ' => 'ASDFASDFASDF ' ,
37
+ );
30
38
}
31
39
32
40
public function testAuthorizeSuccess ()
@@ -77,6 +85,28 @@ public function testPurchaseFailure()
77
85
$ this ->assertSame ('This transaction cannot be processed. The amount to be charged is zero. ' , $ response ->getMessage ());
78
86
}
79
87
88
+ public function testVoidSuccess ()
89
+ {
90
+ $ this ->setMockHttpResponse ('ExpressVoidSuccess.txt ' );
91
+
92
+ $ response = $ this ->gateway ->void ($ this ->voidOptions )->send ();
93
+
94
+ $ this ->assertInstanceOf ('\Omnipay\PayPal\Message\Response ' , $ response );
95
+ $ this ->assertTrue ($ response ->isSuccessful ());
96
+ $ this ->assertFalse ($ response ->isRedirect ());
97
+ $ this ->assertEquals ('ASDFASDFASDF ' , $ response ->getTransactionReference ());
98
+ }
99
+
100
+ public function testVoidFailure ()
101
+ {
102
+ $ this ->setMockHttpResponse ('ExpressVoidFailure.txt ' );
103
+
104
+ $ response = $ this ->gateway ->void ($ this ->voidOptions )->send ();
105
+
106
+ $ this ->assertInstanceOf ('\Omnipay\PayPal\Message\Response ' , $ response );
107
+ $ this ->assertFalse ($ response ->isSuccessful ());
108
+ }
109
+
80
110
public function testFetchCheckout ()
81
111
{
82
112
$ options = array ('token ' => 'abc123 ' );
0 commit comments