Skip to content

Commit

Permalink
Merge pull request #83 from thephpleague/feat-php8
Browse files Browse the repository at this point in the history
Initial upgrade to PHP8.0 and Github Actions
  • Loading branch information
barryvdh authored Jun 2, 2021
2 parents 99d5ad4 + 645bc51 commit 57813f5
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 79 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [barryvdh]
11 changes: 4 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@
"psr-4": { "Omnipay\\Mollie\\Test\\": "tests/" }
},
"require": {
"omnipay/common": "^3.0.1"
"php": "^7.3|^8.0",
"omnipay/common": "^3.1"
},
"require-dev": {
"omnipay/tests": "^3.1",
"squizlabs/php_codesniffer": "^3",
"phpro/grumphp": "^0.14",
"phpmd/phpmd": "^2",
"overtrue/phplint": "^1",
"jakub-onderka/php-parallel-lint": "^1"
"omnipay/tests": "^4.0.2",
"squizlabs/php_codesniffer": "^3"
},
"extra": {
"branch-alias": {
Expand Down
22 changes: 0 additions & 22 deletions grumphp.yml

This file was deleted.

15 changes: 8 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
Expand All @@ -8,15 +9,15 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Omnipay Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
</phpunit>
7 changes: 3 additions & 4 deletions tests/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GatewayTest extends GatewayTestCase
*/
protected $gateway;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -96,11 +96,10 @@ public function testRefund()
);
}

/**
* @expectedException \Omnipay\Common\Exception\InvalidRequestException
*/
public function testThatRefundDoesntWorkWithoutAmount()
{
$this->expectException(\Omnipay\Common\Exception\InvalidRequestException::class);

$request = $this->gateway->refund(
array(
'apiKey' => 'key',
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/AbstractMollieRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AbstractMollieRequestTest extends TestCase
*/
protected $gateway;

public function setUp()
public function setUp(): void
{
$this->gateway = new Gateway($this->getHttpClient());
}
Expand Down
4 changes: 0 additions & 4 deletions tests/Message/AssertRequestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

trait AssertRequestTrait
{
abstract function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false);

abstract function assertJsonStringEqualsJsonString($expected, $actual, $message = null);

public function assertEqualRequest(\Psr\Http\Message\RequestInterface $expectedRequest, \Psr\Http\Message\RequestInterface $actualRequest)
{
$this->assertEquals($expectedRequest->getMethod(), $actualRequest->getMethod(), "Expected request Method should be equal to actual request method.");
Expand Down
9 changes: 5 additions & 4 deletions tests/Message/CancelOrderRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class CancelOrderRequestTest extends TestCase
*/
private $request;

public function setUp()
public function setUp(): void
{
$this->httpClient = $this->createMock(ClientInterface::class);
$this->request = new CancelOrderRequest($this->httpClient, $this->getHttpRequest());
Expand All @@ -46,12 +46,11 @@ public function responseDataProvider()
/**
* @dataProvider insufficientDataProvider
*
* @expectedException \Omnipay\Common\Exception\InvalidRequestException
*
* @param array $input
*/
public function testGetDataWillValidateRequiredData(array $input)
{
$this->expectException(\Omnipay\Common\Exception\InvalidRequestException::class);
$this->request->initialize($input);
$this->request->getData();
}
Expand All @@ -77,7 +76,9 @@ public function testSendData(array $responseData, $success)
->with(
'DELETE',
'https://api.mollie.com/v2/orders/ord_kEn1PlbGa',
['Authorization' => 'Bearer mykey']
$this->callback(function ($headers) {
return $headers['Authorization'] == 'Bearer mykey';
})
)->willReturn($response);

$this->request->initialize(['apiKey' => 'mykey', 'transactionReference' => 'ord_kEn1PlbGa']);
Expand Down
8 changes: 3 additions & 5 deletions tests/Message/CompleteOrderRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CompleteOrderRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new CompleteOrderRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(array(
Expand All @@ -30,12 +30,10 @@ public function setUp()
));
}

/**
* @expectedException \Omnipay\Common\Exception\InvalidRequestException
* @expectedExceptionMessage The transactionReference parameter is required
*/
public function testGetDataWithoutIDParameter()
{
$this->expectException(\Omnipay\Common\Exception\InvalidRequestException::class);
$this->expectExceptionMessage('The transactionReference parameter is required');
$this->getHttpRequest()->request->remove('id');

$data = $this->request->getData();
Expand Down
9 changes: 4 additions & 5 deletions tests/Message/CompletePurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CompletePurchaseRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new CompletePurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(array(
Expand All @@ -28,12 +28,11 @@ public function setUp()
));
}

/**
* @expectedException \Omnipay\Common\Exception\InvalidRequestException
* @expectedExceptionMessage The transactionReference parameter is required
*/
public function testGetDataWithoutIDParameter()
{
$this->expectException(\Omnipay\Common\Exception\InvalidRequestException::class);
$this->expectExceptionMessage('The transactionReference parameter is required');

$this->getHttpRequest()->request->remove('id');

$data = $this->request->getData();
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/CreateCustomerMandateRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CreateCustomerMandateRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new CreateCustomerMandateRequest($this->getHttpClient(), $this->getHttpRequest());

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/CreateCustomerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CreateCustomerRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new CreateCustomerRequest($this->getHttpClient(), $this->getHttpRequest());

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/CreateOrderRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CreateOrderRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new CreateOrderRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(array(
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/CreateShipmentRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CreateShipmentRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new CreateShipmentRequest($this->getHttpClient(), $this->getHttpRequest());

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/FetchCustomerMandatesRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FetchCustomerMandatesRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new FetchCustomerMandatesRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/FetchCustomerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FetchCustomerRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new FetchCustomerRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/FetchIssuersRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FetchIssuersRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new FetchIssuersRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(array(
Expand Down
8 changes: 4 additions & 4 deletions tests/Message/FetchOrderRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FetchOrderRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new FetchOrderRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(
Expand Down Expand Up @@ -122,8 +122,8 @@ public function testSendDataWithIncludingPayments()

$response = $request->sendData(['id' => 'ord_kEn1PlbGa']);

self::assertInstanceOf(FetchOrderResponse::class, $response);
self::assertEquals($request, $response->getRequest());
self::assertEquals($expectedData, $response->getData());
$this->assertInstanceOf(FetchOrderResponse::class, $response);
$this->assertEquals($request, $response->getRequest());
$this->assertEquals($expectedData, $response->getData());
}
}
2 changes: 1 addition & 1 deletion tests/Message/FetchPaymentMethodsRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FetchPaymentMethodsRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new FetchPaymentMethodsRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize([
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/FetchTransactionRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FetchTransactionRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new FetchTransactionRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/PurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PurchaseRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(array(
Expand Down
7 changes: 3 additions & 4 deletions tests/Message/RefundRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class RefundRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new RefundRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize([
Expand Down Expand Up @@ -45,11 +45,10 @@ public function testGetData()
$this->assertCount(1, $data);
}

/**
* @expectedException \Omnipay\Common\Exception\InvalidRequestException
*/
public function testGetDataWithoutAmount()
{
$this->expectException(\Omnipay\Common\Exception\InvalidRequestException::class);

$this->request->initialize(
[
'apiKey' => 'mykey',
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/RevokeCustomerMandateRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RevokeCustomerMandateRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new RevokeCustomerMandateRequest($this->getHttpClient(), $this->getHttpRequest());

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/UpdateCustomerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class UpdateCustomerRequestTest extends TestCase
*/
protected $request;

public function setUp()
public function setUp(): void
{
$this->request = new UpdateCustomerRequest($this->getHttpClient(), $this->getHttpRequest());

Expand Down

0 comments on commit 57813f5

Please sign in to comment.