Skip to content

Commit 89c1092

Browse files
committed
Merge branch 'master' of github.com:thephpleague/omnipay-common
2 parents fb54452 + d1ef1b6 commit 89c1092

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

UPGRADE.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Upgrade apps from 2.x to 3.x
22
- The `redirect()` method no calls `exit()` after sending the content. This is up to the developer now.
3+
- It is now possible to use `setAmountInteger(integer $value)` and `setMoney(Money $money)`
4+
- HTTPPlug is used. Guzzle will be installed when using `omnipay/omnipay`, otherwise you need to required your own implementation (see http://docs.php-http.org/en/latest/clients.html)
35

46
## Upgrade Gateways from 2.x to 3.x
57

@@ -18,6 +20,40 @@ Gateways should not rely on Guzzle or other clients directly.
1820
- `$body` should be a string (eg. `http_build_query($data)` or `json_encode($data)` instead of just `$data`).
1921
- The `$headers` parameters should be an `array` (not `null`, but can be empty)
2022

21-
Note: Prior to stable release, the goal is to migrate to PSR-18, once completed.
22-
This will not change the gateway implementations.
23+
Examples:
24+
```php
25+
// V2 XML:
26+
$response = $this->httpClient->post($this->endpoint, null, $data)->send();
27+
$result = $httpResponse->xml();
28+
29+
// V3 XML:
30+
$response = $this->httpClient->request('POST', $this->endpoint, [], http_build_query($data));
31+
$result = simplexml_load_string($httpResponse->getBody()->getContents());
32+
```
33+
34+
```php
35+
// Example JSON request:
36+
37+
$response = $this->httpClient->request('POST', $this->endpoint, [
38+
'Accept' => 'application/json',
39+
'Content-Type' => 'application/json',
40+
], json_encode($data));
41+
42+
$result = json_decode($response->getBody()->getContents(), true);
43+
```
44+
45+
#### Testing
46+
47+
PHPUnit is upgraded to PHPUnit 6. Common issues:
48+
49+
```php
50+
// PHPUnit 5:
51+
$this->setExpectedException($class, $message);
52+
53+
// PHPUnit 6:
54+
$this->expectException($class);
55+
$this->expectExceptionMessage($message);
56+
```
57+
58+
Tests that do not perform any assertions, will be marked as risky. This can be avoided by annotating them with ` @doesNotPerformAssertions`
2359

0 commit comments

Comments
 (0)