@@ -9,7 +9,8 @@ class RestResponseTest extends TestCase
9
9
public function testPurchaseSuccess ()
10
10
{
11
11
$ httpResponse = $ this ->getMockHttpResponse ('RestPurchaseSuccess.txt ' );
12
- $ response = new RestResponse ($ this ->getMockRequest (), $ httpResponse ->json (), $ httpResponse ->getStatusCode ());
12
+ $ data = json_decode ($ httpResponse ->getBody ()->getContents (), true );
13
+ $ response = new RestResponse ($ this ->getMockRequest (), $ data , $ httpResponse ->getStatusCode ());
13
14
14
15
$ this ->assertTrue ($ response ->isSuccessful ());
15
16
$ this ->assertSame ('44E89981F8714392Y ' , $ response ->getTransactionReference ());
@@ -19,7 +20,8 @@ public function testPurchaseSuccess()
19
20
public function testPurchaseFailure ()
20
21
{
21
22
$ httpResponse = $ this ->getMockHttpResponse ('RestPurchaseFailure.txt ' );
22
- $ response = new RestResponse ($ this ->getMockRequest (), $ httpResponse ->json (), $ httpResponse ->getStatusCode ());
23
+ $ data = json_decode ($ httpResponse ->getBody ()->getContents (), true );
24
+ $ response = new RestResponse ($ this ->getMockRequest (), $ data , $ httpResponse ->getStatusCode ());
23
25
24
26
$ this ->assertFalse ($ response ->isSuccessful ());
25
27
$ this ->assertNull ($ response ->getTransactionReference ());
@@ -29,7 +31,9 @@ public function testPurchaseFailure()
29
31
public function testCompletePurchaseSuccess ()
30
32
{
31
33
$ httpResponse = $ this ->getMockHttpResponse ('RestCompletePurchaseSuccess.txt ' );
32
- $ response = new RestResponse ($ this ->getMockRequest (), $ httpResponse ->json (), $ httpResponse ->getStatusCode ());
34
+ $ data = json_decode ($ httpResponse ->getBody ()->getContents (), true );
35
+
36
+ $ response = new RestResponse ($ this ->getMockRequest (), $ data , $ httpResponse ->getStatusCode ());
33
37
34
38
$ this ->assertTrue ($ response ->isSuccessful ());
35
39
$ this ->assertSame ('9EA05739TH369572R ' , $ response ->getTransactionReference ());
@@ -39,7 +43,9 @@ public function testCompletePurchaseSuccess()
39
43
public function testCompletePurchaseFailure ()
40
44
{
41
45
$ httpResponse = $ this ->getMockHttpResponse ('RestCompletePurchaseFailure.txt ' );
42
- $ response = new RestResponse ($ this ->getMockRequest (), $ httpResponse ->json (), $ httpResponse ->getStatusCode ());
46
+ $ data = json_decode ($ httpResponse ->getBody ()->getContents (), true );
47
+
48
+ $ response = new RestResponse ($ this ->getMockRequest (), $ data , $ httpResponse ->getStatusCode ());
43
49
44
50
$ this ->assertFalse ($ response ->isSuccessful ());
45
51
$ this ->assertNull ($ response ->getTransactionReference ());
@@ -49,7 +55,9 @@ public function testCompletePurchaseFailure()
49
55
public function testTokenFailure ()
50
56
{
51
57
$ httpResponse = $ this ->getMockHttpResponse ('RestTokenFailure.txt ' );
52
- $ response = new RestResponse ($ this ->getMockRequest (), $ httpResponse ->json (), $ httpResponse ->getStatusCode ());
58
+ $ data = json_decode ($ httpResponse ->getBody ()->getContents (), true );
59
+
60
+ $ response = new RestResponse ($ this ->getMockRequest (), $ data , $ httpResponse ->getStatusCode ());
53
61
54
62
$ this ->assertFalse ($ response ->isSuccessful ());
55
63
$ this ->assertSame ('Client secret does not match for this client ' , $ response ->getMessage ());
@@ -58,7 +66,9 @@ public function testTokenFailure()
58
66
public function testAuthorizeSuccess ()
59
67
{
60
68
$ httpResponse = $ this ->getMockHttpResponse ('RestAuthorizationSuccess.txt ' );
61
- $ response = new RestResponse ($ this ->getMockRequest (), $ httpResponse ->json (), $ httpResponse ->getStatusCode ());
69
+ $ data = json_decode ($ httpResponse ->getBody ()->getContents (), true );
70
+
71
+ $ response = new RestResponse ($ this ->getMockRequest (), $ data , $ httpResponse ->getStatusCode ());
62
72
63
73
$ this ->assertTrue ($ response ->isSuccessful ());
64
74
$ this ->assertSame ('58N7596879166930B ' , $ response ->getTransactionReference ());
@@ -68,7 +78,9 @@ public function testAuthorizeSuccess()
68
78
public function testCreateCardSuccess ()
69
79
{
70
80
$ httpResponse = $ this ->getMockHttpResponse ('RestCreateCardSuccess.txt ' );
71
- $ response = new RestResponse ($ this ->getMockRequest (), $ httpResponse ->json (), $ httpResponse ->getStatusCode ());
81
+ $ data = json_decode ($ httpResponse ->getBody ()->getContents (), true );
82
+
83
+ $ response = new RestResponse ($ this ->getMockRequest (), $ data , $ httpResponse ->getStatusCode ());
72
84
73
85
$ this ->assertTrue ($ response ->isSuccessful ());
74
86
$ this ->assertSame ('CARD-70E78145XN686604FKO3L6OQ ' , $ response ->getCardReference ());
0 commit comments