Skip to content

Commit

Permalink
Merge pull request #19 from AndrewNovikof/feature/upgrade_omnipay_3_2
Browse files Browse the repository at this point in the history
support php 8.1 and omnipay 3.2
  • Loading branch information
AndrewNovikof authored Dec 12, 2022
2 parents ed712e1 + 394fd17 commit d231afe
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 42 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
syntaxCheck="false">
<testsuites>
<testsuite name="Omnipay Test Suite">
<directory>./tests/</directory>
<directory>tests</directory>
</testsuite>
</testsuites>
<listeners>
Expand Down
46 changes: 24 additions & 22 deletions tests/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/AbstractRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/AuthorizeRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/BindCardRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/CaptureRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/ExtendedBindingRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/ExtendedOrderStatusRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/GetBindingsByCardOrIdRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/GetBindingsRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/GetLastOrdersForMerchantsRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/OrderStatusRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/PurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/RefundRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/UpdateSSLCardsListRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/VerifyEnrollmentRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/Message/VoidRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d231afe

Please sign in to comment.