8000 Omnipay v3 compatibility and removed unecessary var_dump in a test. (… · thephpleague/omnipay-netaxept@d5e56f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5e56f7

Browse files
erikstorlibarryvdh
authored andcommitted
Omnipay v3 compatibility and removed unecessary var_dump in a test. (#13)
* Omnipay v3 compatibility and removed unecessary var_dump in a test. * Adding php_codesniffer * Remove PHP 5.4 & 5.5 from travis.yml. * Removing PHP 5.3 and adding 7.2 & 7.3.
1 parent 4cefa26 commit d5e56f7

File tree

10 files changed

+35
-34
lines changed

10 files changed

+35
-34
lines changed

.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
language: php
22

33
php:
4-
- 5.4
5-
- 5.5
64
- 5.6
75
- 7.0
86
- 7.1
9-
10-
matrix:
11-
include:
12-
- php: 5.3
13-
dist: precise
7+
- 7.2
8+
- 7.3
149

1510
before_script:
1611
- composer install -n --dev --prefer-source

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
"psr-4": { "Omnipay\\Netaxept\\" : "src/" }
2727
},
2828
"require": {
29-
"omnipay/common": "~2.0"
29+
"omnipay/common": "~3.0"
3030
},
3131
"require-dev": {
32-
"omnipay/tests": "~2.0"
32+
"omnipay/tests": "~3.0",
33+
"squizlabs/php_codesniffer": "^3"
3334
},
3435
"extra": {
3536
"branch-alias": {

phpunit.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
<directory>./tests/</directory>
1515
</testsuite>
1616
</testsuites>
17-
<listeners>
18-
<listener class="Mockery\Adapter\Phpunit\TestListener" file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" />
19-
</listeners>
2017
<filter>
2118
<whitelist>
2219
<directory>./src</directory>

src/Message/AnnulRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function getData()
3131
public function sendData($data)
3232
{
3333
$url = $this->getEndpoint().'/Netaxept/Process.aspx?';
34-
$httpResponse = $this->httpClient->get($url.http_build_query($data))->send();
34+
$httpResponse = $this->httpClient->request('GET', $url.http_build_query($data));
3535

36-
return $this->response = new Response($this, $httpResponse->xml());
36+
return $this->response = new Response($this, simplexml_load_string($httpResponse->getBody()->getContents()));
3737
}
3838
}

src/Message/CaptureRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function getData()
3030
public function sendData($data)
3131
{
3232
$url = $this->getEndpoint().'/Netaxept/Process.aspx?';
33-
$httpResponse = $this->httpClient->get($url.http_build_query($data))->send();
33+
$httpResponse = $this->httpClient->request('GET', $url.http_build_query($data));
3434

35-
return $this->response = new Response($this, $httpResponse->xml());
35+
return $this->response = new Response($this, simplexml_load_string($httpResponse->getBody()->getContents()));
3636
}
3737
}

src/Message/CompletePurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public function sendData($data)
3232
}
3333

3434
$url = $this->getEndpoint().'/Netaxept/Process.aspx?';
35-
$httpResponse = $this->httpClient->get($url.http_build_query($data))->send();
35+
$httpResponse = $this->httpClient->request('GET', $url.http_build_query($data));
3636

37-
return $this->response = new Response($this, $httpResponse->xml());
37+
return $this->response = new Response($this, simplexml_load_string($httpResponse->getBody()->getContents()));
3838
}
3939
}

src/Message/CreditRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function getData()
3131
public function sendData($data)
3232
{
3333
$url = $this->getEndpoint().'/Netaxept/Process.aspx?';
34-
$httpResponse = $this->httpClient->get($url.http_build_query($data))->send();
34+
$httpResponse = $this->httpClient->request('GET', $url.http_build_query($data));
3535

36-
return $this->response = new Response($this, $httpResponse->xml());
36+
return $this->response = new Response($this, simplexml_load_string($httpResponse->getBody()->getContents()));
3737
}
3838
}

src/Message/PurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ public function getData()
7474
public function sendData($data)
7575
{
7676
$url = $this->getEndpoint().'/Netaxept/Register.aspx?';
77-
$httpResponse = $this->httpClient->get($url.http_build_query($data))->send();
77+
$httpResponse = $this->httpClient->request('GET', $url.http_build_query($data));
7878

79-
return $this->response = new Response($this, $httpResponse->xml());
79+
return $this->response = new Response($this, simplexml_load_string($httpResponse->getBody()->getContents()));
8080
}
8181

8282
public function getEndpoint()

tests/GatewayTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ public function testCompletePurchaseFailure()
100100
$this->assertFalse($response->isRedirect());
101101
$this->assertNull($response->getTransactionReference());
102102

103-
var_dump($response->getMessage());
104-
105103
$this->assertSame('Unable to find transaction', $response->getMessage());
106104
}
107105

tests/Message/ResponseTest.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class ResponseTest extends TestCase
99
public function testPurchaseSuccess()
1010
{
1111
$httpResponse = $this->getMockHttpResponse('PurchaseSuccess.txt');
12-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
12+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
13+
$response = new Response($this->getMockRequest(), $xml);
1314

1415
$this->assertFalse($response->isSuccessful());
1516
$this->assertTrue($response->isRedirect());
@@ -20,7 +21,8 @@ public function testPurchaseSuccess()
2021
public function testPurchaseFailure()
2122
{
2223
$httpResponse = $this->getMockHttpResponse('PurchaseFailure.txt');
23-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
24+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
25+
$response = new Response($this->getMockRequest(), $xml);
2426

2527
$this->assertFalse($response->isSuccessful());
2628
$this->assertFalse($response->isRedirect());
@@ -33,7 +35,8 @@ public function testPurchaseFailure()
3335
public function testCompletePurchaseSuccess()
3436
{
3537
$httpResponse = $this->getMockHttpResponse('CompletePurchaseSuccess.txt');
36-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
38+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
39+
$response = new Response($this->getMockRequest(), $xml);
3740

3841
$this->assertTrue($response->isSuccessful());
3942
$this->assertFalse($response->isRedirect());
@@ -44,7 +47,8 @@ public function testCompletePurchaseSuccess()
4447
public function testCompletePurchaseFailure()
4548
{
4649
$httpResponse = $this->getMockHttpResponse('CompletePurchaseFailure.txt');
47-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
50+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
51+
$response = new Response($this->getMockRequest(), $xml);
4852

4953
$this->assertFalse($response->isSuccessful());
5054
$this->assertFalse($response->isRedirect());
@@ -55,7 +59,8 @@ public function testCompletePurchaseFailure()
5559
public function testCaptureSuccess()
5660
{
5761
$httpResponse = $this->getMockHttpResponse('CaptureSuccess.txt');
58-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
62+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
63+
$response = new Response($this->getMockRequest(), $xml);
5964

6065
$this->assertTrue($response->isSuccessful());
6166
$this->assertFalse($response->isRedirect());
@@ -66,7 +71,8 @@ public function testCaptureSuccess()
6671
public function testCaptureFailure()
6772
{
6873
$httpResponse = $this->getMockHttpResponse('CaptureFailure.txt');
69-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
74+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
75+
$response = new Response($this->getMockRequest(), $xml);
7076

7177
$this->assertFalse($response->isSuccessful());
7278
$this->assertFalse($response->isRedirect());
@@ -77,7 +83,8 @@ public function testCaptureFailure()
7783
public function testAnnulSuccess()
7884
{
7985
$httpResponse = $this->getMockHttpResponse('AnnulSuccess.txt');
80-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
86+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
87+
$response = new Response($this->getMockRequest(), $xml);
8188

8289
$this->assertTrue($response->isSuccessful());
8390
$this->assertFalse($response->isRedirect());
@@ -88,7 +95,8 @@ public function testAnnulSuccess()
8895
public function testAnnullFailure()
8996
{
9097
$httpResponse = $this->getMockHttpResponse('AnnulFailure.txt');
91-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
98+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
99+
$response = new Response($this->getMockRequest(), $xml);
92100

93101
$this->assertFalse($response->isSuccessful());
94102
$this->assertFalse($response->isRedirect());
@@ -99,7 +107,8 @@ public function testAnnullFailure()
99107
public function testCreditSuccess()
100108
{
101109
$httpResponse = $this->getMockHttpResponse('CreditSuccess.txt');
102-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
110+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
111+
$response = new Response($this->getMockRequest(), $xml);
103112

104113
$this->assertTrue($response->isSuccessful());
105114
$this->assertFalse($response->isRedirect());
@@ -110,7 +119,8 @@ public function testCreditSuccess()
110119
public function testCreditFailure()
111120
{
112121
$httpResponse = $this->getMockHttpResponse('CreditFailure.txt');
113-
$response = new Response($this->getMockRequest(), $httpResponse->xml());
122+
$xml = simplexml_load_string($httpResponse->getBody()->getContents());
123+
$response = new Response($this->getMockRequest(), $xml);
114124

115125
$this->assertFalse($response->isSuccessful());
116126
$this->assertFalse($response->isRedirect());

0 commit comments

Comments
 (0)
0