From f2a25ecf7be24e0f47a28b4eea4303dd7cc02ae7 Mon Sep 17 00:00:00 2001 From: Aylin Neuberger Date: Wed, 19 Jun 2024 17:35:10 +0200 Subject: [PATCH 1/4] Php 8.1 --- .gitlab-ci.yml | 5 +++ Action/Api/ConvertGiropayErrorsAction.php | 2 +- Tests/ApiTest.php | 7 ++-- Tests/PayoneGatewayFactoryTest.php | 28 --------------- composer.json | 7 ++-- phpunit.xml.dist | 43 ++++++++--------------- 6 files changed, 29 insertions(+), 63 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 908e66f..04b4600 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,3 +14,8 @@ test:7.2: script: - php composer.phar test +test:8.1: + image: php:8.1 + script: + - php composer.phar test + diff --git a/Action/Api/ConvertGiropayErrorsAction.php b/Action/Api/ConvertGiropayErrorsAction.php index 945abfa..6d67d1c 100644 --- a/Action/Api/ConvertGiropayErrorsAction.php +++ b/Action/Api/ConvertGiropayErrorsAction.php @@ -36,7 +36,7 @@ public function execute($request) $response = $request->getResponse(); if (Api::STATUS_ERROR != $response[Api::FIELD_STATUS] - || !array_key_exists(Api::FIELD_PAYMENT_METHOD, $model) + || !$model[Api::FIELD_PAYMENT_METHOD] || $model[Api::FIELD_PAYMENT_METHOD] != Api::PAYMENT_METHOD_GIROPAY ) { return; diff --git a/Tests/ApiTest.php b/Tests/ApiTest.php index 7ec2f34..e4f1422 100755 --- a/Tests/ApiTest.php +++ b/Tests/ApiTest.php @@ -7,6 +7,7 @@ use Payum\Core\Bridge\Guzzle\HttpClient; use Payum\Core\HttpClientInterface; use Payum\Core\Tests\TestCase; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -96,7 +97,7 @@ public function testDecodeBodyHandlesNewlineInMandateText() Api::FIELD_LAST_NAME => 'Mustermann', ]); - $this->assertInternalType('array', $response); + $this->assertIsArray($response); $this->assertArrayHasKey(Api::FIELD_MANDATE_TEXT, $response); $this->assertStringStartsWith('
', $response[Api::FIELD_MANDATE_TEXT]); $this->assertStringEndsWith('
', $response[Api::FIELD_MANDATE_TEXT]); @@ -204,7 +205,7 @@ protected function createHttpClient() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|HttpClientInterface + * @return MockObject|HttpClientInterface */ protected function createHttpClientMock() { @@ -212,7 +213,7 @@ protected function createHttpClientMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|HttpClientInterface + * @return MockObject|HttpClientInterface */ protected function createSuccessHttpClientStub($responseBody = '') { diff --git a/Tests/PayoneGatewayFactoryTest.php b/Tests/PayoneGatewayFactoryTest.php index 27ecf17..6264c2c 100755 --- a/Tests/PayoneGatewayFactoryTest.php +++ b/Tests/PayoneGatewayFactoryTest.php @@ -29,28 +29,6 @@ public function couldBeConstructedWithoutAnyArguments() new PayoneGatewayFactory(); } - /** - * @test - */ - public function shouldCreateCoreGatewayFactoryIfNotPassed() - { - $factory = new PayoneGatewayFactory(); - - $this->assertAttributeInstanceOf(CoreGatewayFactory::class, 'coreGatewayFactory', $factory); - } - - /** - * @test - */ - public function shouldUseCoreGatewayFactoryPassedAsSecondArgument() - { - $coreGatewayFactory = $this->createMock(GatewayFactoryInterface::class); - - $factory = new PayoneGatewayFactory(array(), $coreGatewayFactory); - - $this->assertAttributeSame($coreGatewayFactory, 'coreGatewayFactory', $factory); - } - /** * @test */ @@ -66,12 +44,6 @@ public function shouldAllowCreateGateway() ]); $this->assertInstanceOf('Payum\Core\Gateway', $gateway); - - $this->assertAttributeNotEmpty('apis', $gateway); - $this->assertAttributeNotEmpty('actions', $gateway); - - $extensions = $this->readAttribute($gateway, 'extensions'); - $this->assertAttributeNotEmpty('extensions', $extensions); } /** diff --git a/composer.json b/composer.json index 1758004..c132731 100755 --- a/composer.json +++ b/composer.json @@ -14,13 +14,14 @@ } ], "require": { - "php": ">=7.1.3", + "php": ">=7.1.3 | ^8.1", "payum/core": "^1.7", "psr/log": "^1.0", - "php-http/guzzle7-adapter": "^1.0" + "php-http/guzzle7-adapter": "^1.0", + "php-http/message-factory": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2715737..f67e5a6 100755 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,30 +1,17 @@ - - - - ./Tests - - - - - - ./ - - ./Tests - ./vendor - - - + + + + ./ + + + ./Tests + ./vendor + + + + + ./Tests + + From e1f6459103c96078c82686cef6ef72527b7d441a Mon Sep 17 00:00:00 2001 From: Aylin Neuberger Date: Wed, 19 Jun 2024 17:40:22 +0200 Subject: [PATCH 2/4] Php 8.1 --- .github/workflows/ci.yml | 15 ++++++++------- .travis.yml | 25 ------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) delete mode 100755 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b5eb81..b3affe3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: [push, pull_request] jobs: - build-test-71: + build-test-74: runs-on: ubuntu-latest steps: @@ -11,17 +11,18 @@ jobs: - uses: php-actions/composer@v6 with: - version: 1 - php_version: "7.1" + version: 2 + php_version: "7.4" - name: PHPUnit Tests uses: php-actions/phpunit@v3 with: version: 7 - php_version: "7.1" + php_version: "7.4" configuration: phpunit.xml.dist bootstrap: vendor/autoload.php - build-test-74: + + build-test-81: runs-on: ubuntu-latest steps: @@ -30,12 +31,12 @@ jobs: - uses: php-actions/composer@v6 with: version: 2 - php_version: "7.4" + php_version: "8.1" - name: PHPUnit Tests uses: php-actions/phpunit@v3 with: version: 7 - php_version: "7.4" + php_version: "8.1" configuration: phpunit.xml.dist bootstrap: vendor/autoload.php diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index a2914bd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: php - -php: - - '5.5' - - '5.6' - - '7.0' - - hhvm - - nightly - -cache: - directories: - - $HOME/.composer/cache - -git: - depth: 1 - -before_install: - - travis_retry composer self-update - -install: - - travis_retry composer update - -script: - - composer run-script phplint - - vendor/bin/phpunit --coverage-text From 38e0e01c7590ecb26185b140af0b06562faa2a0a Mon Sep 17 00:00:00 2001 From: Aylin Neuberger Date: Wed, 19 Jun 2024 17:44:42 +0200 Subject: [PATCH 3/4] Php 8.1 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3affe3..f93e18e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: PHPUnit Tests uses: php-actions/phpunit@v3 with: - version: 7 + version: 9 php_version: "7.4" configuration: phpunit.xml.dist bootstrap: vendor/autoload.php @@ -36,7 +36,7 @@ jobs: - name: PHPUnit Tests uses: php-actions/phpunit@v3 with: - version: 7 + version: 9 php_version: "8.1" configuration: phpunit.xml.dist bootstrap: vendor/autoload.php From 17564979ad534067c9028bebe4663377fdfcd65c Mon Sep 17 00:00:00 2001 From: Aylin Neuberger Date: Thu, 20 Jun 2024 08:44:25 +0200 Subject: [PATCH 4/4] Review changes --- .gitlab-ci.yml | 21 ------------------- .../Api/GetSepaMandatePdfActionTest.php | 3 --- Tests/ApiTest.php | 2 -- composer.json | 2 +- 4 files changed, 1 insertion(+), 27 deletions(-) delete mode 100755 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100755 index 04b4600..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,21 +0,0 @@ -cache: - paths: - - vendor/ - -before_script: -- apt-get update -- apt-get install -y zlib1g-dev -- docker-php-ext-install zip -- curl -sS https://getcomposer.org/installer | php -- php composer.phar install --prefer-dist --no-progress --no-interaction - -test:7.2: - image: php:7.2 - script: - - php composer.phar test - -test:8.1: - image: php:8.1 - script: - - php composer.phar test - diff --git a/Tests/Action/Api/GetSepaMandatePdfActionTest.php b/Tests/Action/Api/GetSepaMandatePdfActionTest.php index 96221e8..0817ff5 100755 --- a/Tests/Action/Api/GetSepaMandatePdfActionTest.php +++ b/Tests/Action/Api/GetSepaMandatePdfActionTest.php @@ -2,10 +2,7 @@ namespace Valiton\Payum\Payone\Tests\Action\Api; -use GuzzleHttp\Client; -use Payum\Core\Bridge\Guzzle\HttpClient; use Valiton\Payum\Payone\Action\Api\GetSepaMandatePdfAction; -use Valiton\Payum\Payone\Api; use Valiton\Payum\Payone\Request\Api\GetSepaMandatePdf; use Valiton\Payum\Payone\Tests\Action\AbstractActionTest; diff --git a/Tests/ApiTest.php b/Tests/ApiTest.php index e4f1422..04a124b 100755 --- a/Tests/ApiTest.php +++ b/Tests/ApiTest.php @@ -9,8 +9,6 @@ use Payum\Core\Tests\TestCase; use PHPUnit\Framework\MockObject\MockObject; use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\StreamInterface; use Valiton\Payum\Payone\Api; class ApiTest extends TestCase diff --git a/composer.json b/composer.json index c132731..c846315 100755 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": ">=7.1.3 | ^8.1", + "php": ">=7.3 | ^8.1", "payum/core": "^1.7", "psr/log": "^1.0", "php-http/guzzle7-adapter": "^1.0",