From 394fd179be183dc0e805d9596aaf288c5d6b6f5a Mon Sep 17 00:00:00 2001 From: Andrew Novikov Date: Mon, 12 Dec 2022 17:37:17 +0300 Subject: [PATCH] support php 8.1 and omnipay 3.2 --- composer.json | 8 ++-- phpunit.xml.dist | 2 +- tests/GatewayTest.php | 46 ++++++++++--------- tests/Message/AbstractRequestTest.php | 2 +- tests/Message/AuthorizeRequestTest.php | 2 +- tests/Message/BindCardRequestTest.php | 2 +- tests/Message/CaptureRequestTest.php | 2 +- tests/Message/ExtendedBindingRequestTest.php | 2 +- .../ExtendedOrderStatusRequestTest.php | 2 +- .../GetBindingsByCardOrIdRequestTest.php | 2 +- tests/Message/GetBindingsRequestTest.php | 2 +- .../GetLastOrdersForMerchantsRequestTest.php | 2 +- tests/Message/OrderStatusRequestTest.php | 2 +- tests/Message/PurchaseRequestTest.php | 2 +- tests/Message/RefundRequestTest.php | 2 +- .../Message/UpdateSSLCardsListRequestTest.php | 2 +- tests/Message/VerifyEnrollmentRequestTest.php | 2 +- tests/Message/VoidRequestTest.php | 2 +- 18 files changed, 44 insertions(+), 42 deletions(-) diff --git a/composer.json b/composer.json index 6f426d0..de6e8a8 100644 --- a/composer.json +++ b/composer.json @@ -17,12 +17,12 @@ "payment" ], "require": { - "php": "^7.1", - "omnipay/common": "v3.0.3" + "php": "^8.1", + "omnipay/common": "^3.2" }, "require-dev": { - "omnipay/tests": "^3", - "phpunit/phpunit": "^5.7|^6", + "omnipay/tests": "^4", + "phpunit/phpunit": "^8|^9", "squizlabs/php_codesniffer": "3.*" }, "autoload": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a35b736..22e3379 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,7 +11,7 @@ syntaxCheck="false"> - ./tests/ + tests diff --git a/tests/GatewayTest.php b/tests/GatewayTest.php index b36a746..4cfb0f4 100644 --- a/tests/GatewayTest.php +++ b/tests/GatewayTest.php @@ -50,7 +50,7 @@ class GatewayTest extends GatewayTestCase * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -168,40 +168,42 @@ public function testGetBindings() $this->assertInstanceOf(GetBindingsRequest::class, $this->gateway->getBindings()); } - /** - * @expectedException BadMethodCallException - */ public function testDeleteCard() { - $this->assertFalse($this->gateway->supportsDeleteCard()); - $this->assertTrue(method_exists($this->gateway, 'deleteCard')); - $this->assertInstanceOf(BadMethodCallException::class, $this->gateway->deleteCard()); + + try { + $this->assertFalse($this->gateway->supportsDeleteCard()); + $this->assertTrue(method_exists($this->gateway, 'deleteCard')); + } catch (\Exception $e) { + $this->expectException(BadMethodCallException::class); + } + } - /** - * @expectedException BadMethodCallException - */ public function testCreateCard() { - $this->assertFalse($this->gateway->supportsCreateCard()); - $this->assertTrue(method_exists($this->gateway, 'createCard')); - $this->assertInstanceOf(BadMethodCallException::class, $this->gateway->createCard()); + try { + $this->assertFalse($this->gateway->supportsCreateCard()); + $this->assertTrue(method_exists($this->gateway, 'createCard')); + } catch (\Exception $e) { + $this->expectException(BadMethodCallException::class); + } } - /** - * @expectedException BadMethodCallException - */ public function testUpdateCard() { - $this->assertFalse($this->gateway->supportsUpdateCard()); - $this->assertTrue(method_exists($this->gateway, 'updateCard')); - $this->assertInstanceOf(BadMethodCallException::class, $this->gateway->updateCard()); + try { + $this->assertFalse($this->gateway->supportsUpdateCard()); + $this->assertTrue(method_exists($this->gateway, 'updateCard')); + } catch (\Exception $e) { + $this->expectException(BadMethodCallException::class); + } } public function testSupportsCreateCard() { $supportsCreate = $this->gateway->supportsCreateCard(); - $this->assertInternalType('boolean', $supportsCreate); + $this->assertIsBool($supportsCreate); if ($supportsCreate) { $this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->createCard()); @@ -211,7 +213,7 @@ public function testSupportsCreateCard() public function testSupportsDeleteCard() { $supportsDelete = $this->gateway->supportsDeleteCard(); - $this->assertInternalType('boolean', $supportsDelete); + $this->assertIsBool($supportsDelete); if ($supportsDelete) { $this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->deleteCard()); @@ -221,7 +223,7 @@ public function testSupportsDeleteCard() public function testSupportsUpdateCard() { $supportsUpdate = $this->gateway->supportsUpdateCard(); - $this->assertInternalType('boolean', $supportsUpdate); + $this->assertIsBool($supportsUpdate); if ($supportsUpdate) { $this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->updateCard()); diff --git a/tests/Message/AbstractRequestTest.php b/tests/Message/AbstractRequestTest.php index 1e8844c..1982477 100644 --- a/tests/Message/AbstractRequestTest.php +++ b/tests/Message/AbstractRequestTest.php @@ -42,7 +42,7 @@ abstract class AbstractRequestTest extends TestCase * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->request = $this->getRequestClass(); $this->userName = uniqid('login', true); diff --git a/tests/Message/AuthorizeRequestTest.php b/tests/Message/AuthorizeRequestTest.php index 3f9d635..768f290 100644 --- a/tests/Message/AuthorizeRequestTest.php +++ b/tests/Message/AuthorizeRequestTest.php @@ -43,7 +43,7 @@ class AuthorizeRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->amount = mt_rand(1, 100); $this->returnUrl = 'https://test.com/' . uniqid('', true); diff --git a/tests/Message/BindCardRequestTest.php b/tests/Message/BindCardRequestTest.php index 4f180b2..554d927 100644 --- a/tests/Message/BindCardRequestTest.php +++ b/tests/Message/BindCardRequestTest.php @@ -22,7 +22,7 @@ class BindCardRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->bindingId = uniqid('bindingId-', true); diff --git a/tests/Message/CaptureRequestTest.php b/tests/Message/CaptureRequestTest.php index 444096e..c3db1c2 100644 --- a/tests/Message/CaptureRequestTest.php +++ b/tests/Message/CaptureRequestTest.php @@ -22,7 +22,7 @@ class CaptureRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->amount = random_int(1000, 100000); diff --git a/tests/Message/ExtendedBindingRequestTest.php b/tests/Message/ExtendedBindingRequestTest.php index 7f87649..f1c9ed3 100644 --- a/tests/Message/ExtendedBindingRequestTest.php +++ b/tests/Message/ExtendedBindingRequestTest.php @@ -28,7 +28,7 @@ class ExtendedBindingRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->bindingId = mt_rand(1, 100); $this->newExpiry = '201712'; diff --git a/tests/Message/ExtendedOrderStatusRequestTest.php b/tests/Message/ExtendedOrderStatusRequestTest.php index 6d8cdd2..77a4703 100644 --- a/tests/Message/ExtendedOrderStatusRequestTest.php +++ b/tests/Message/ExtendedOrderStatusRequestTest.php @@ -22,7 +22,7 @@ class ExtendedOrderStatusRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->orderId = mt_rand(1, 100); diff --git a/tests/Message/GetBindingsByCardOrIdRequestTest.php b/tests/Message/GetBindingsByCardOrIdRequestTest.php index 92db201..5417ba6 100644 --- a/tests/Message/GetBindingsByCardOrIdRequestTest.php +++ b/tests/Message/GetBindingsByCardOrIdRequestTest.php @@ -29,7 +29,7 @@ class GetBindingsByCardOrIdRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->bindingId = uniqid('bindingId-', true); $this->pan = uniqid('pan-', true); diff --git a/tests/Message/GetBindingsRequestTest.php b/tests/Message/GetBindingsRequestTest.php index 9d28670..3012fdd 100644 --- a/tests/Message/GetBindingsRequestTest.php +++ b/tests/Message/GetBindingsRequestTest.php @@ -22,7 +22,7 @@ class GetBindingsRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->clientId = uniqid('clientId-', true); diff --git a/tests/Message/GetLastOrdersForMerchantsRequestTest.php b/tests/Message/GetLastOrdersForMerchantsRequestTest.php index 1056e9d..94786ac 100644 --- a/tests/Message/GetLastOrdersForMerchantsRequestTest.php +++ b/tests/Message/GetLastOrdersForMerchantsRequestTest.php @@ -51,7 +51,7 @@ class GetLastOrdersForMerchantsRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->size = random_int(1, 200); $this->from = 20181112260000; diff --git a/tests/Message/OrderStatusRequestTest.php b/tests/Message/OrderStatusRequestTest.php index 50636f5..a5d8073 100644 --- a/tests/Message/OrderStatusRequestTest.php +++ b/tests/Message/OrderStatusRequestTest.php @@ -22,7 +22,7 @@ class OrderStatusRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->orderId = mt_rand(1, 100); diff --git a/tests/Message/PurchaseRequestTest.php b/tests/Message/PurchaseRequestTest.php index 1016660..4a73fa6 100644 --- a/tests/Message/PurchaseRequestTest.php +++ b/tests/Message/PurchaseRequestTest.php @@ -35,7 +35,7 @@ class PurchaseRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->mdOrder = mt_rand(1, 10000); $this->bindingId = mt_rand(1, 100000); diff --git a/tests/Message/RefundRequestTest.php b/tests/Message/RefundRequestTest.php index 2c23980..3f84b43 100644 --- a/tests/Message/RefundRequestTest.php +++ b/tests/Message/RefundRequestTest.php @@ -26,7 +26,7 @@ class RefundRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->orderId = mt_rand(1, 100); $this->amount = mt_rand(1, 100500); diff --git a/tests/Message/UpdateSSLCardsListRequestTest.php b/tests/Message/UpdateSSLCardsListRequestTest.php index d04a1be..d0f52e7 100644 --- a/tests/Message/UpdateSSLCardsListRequestTest.php +++ b/tests/Message/UpdateSSLCardsListRequestTest.php @@ -21,7 +21,7 @@ class UpdateSSLCardsListRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->mdorder = mt_rand(1, 100); diff --git a/tests/Message/VerifyEnrollmentRequestTest.php b/tests/Message/VerifyEnrollmentRequestTest.php index 3271551..5010819 100644 --- a/tests/Message/VerifyEnrollmentRequestTest.php +++ b/tests/Message/VerifyEnrollmentRequestTest.php @@ -19,7 +19,7 @@ class VerifyEnrollmentRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->pan = mt_rand(1, 100); diff --git a/tests/Message/VoidRequestTest.php b/tests/Message/VoidRequestTest.php index d30c2b2..acf2992 100644 --- a/tests/Message/VoidRequestTest.php +++ b/tests/Message/VoidRequestTest.php @@ -24,7 +24,7 @@ class VoidRequestTest extends AbstractRequestTest * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() + public function setUp(): void { $this->orderId = mt_rand(1, 100);