From f859b696a26ed4468808433eea8258a3893a6637 Mon Sep 17 00:00:00 2001 From: "david.owusu" Date: Tue, 17 Feb 2026 14:45:29 +0100 Subject: [PATCH 1/5] [CC-3237] Add php 8.5 to composer.json --- .github/workflows/unit-tests.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 9dc6dbb9..aa17f8db 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] + php: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] name: PHP ${{ matrix.php }} unit tests steps: - uses: actions/checkout@v3 diff --git a/composer.json b/composer.json index 91dee327..6e891cc6 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "minimum-stability": "stable", "license": "Apache-2.0", "require": { - "php": "~7.4.0|~8.0.0|~8.1.0|~8.2.0|~8.3.0|~8.4.0", + "php": "~8.1.0|~8.2.0|~8.3.0|~8.4.0|~8.5.0", "ext-json": "*" }, "require-dev": { From a2882574ced7129b889f6fd6bed9a0dbbd5794f2 Mon Sep 17 00:00:00 2001 From: "david.owusu" Date: Wed, 18 Feb 2026 12:41:25 +0100 Subject: [PATCH 2/5] [CC-3237] Adjust error reporting to display deprecation warnings. --- .github/workflows/unit-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index aa17f8db..b89821f0 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -18,6 +18,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} + ini-values: error_reporting=E_ALL, display_errors=On, display_startup_errors=On - name: Install dependencies run: composer install --prefer-dist --no-progress - name: Run unit tests From ed9eed4aa401f10936a1759a47e57398e6270da9 Mon Sep 17 00:00:00 2001 From: "david.owusu" Date: Wed, 18 Feb 2026 12:50:38 +0100 Subject: [PATCH 3/5] [CC-3237] Let tests fail on deprecation warnings. --- .github/workflows/integration-tests.yml | 9 ++++++++- composer.json | 2 +- phpunit.xml | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 3e597070..306d576a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -5,6 +5,12 @@ on: branches: - 'main' workflow_dispatch: + inputs: + php-version: + description: 'PHP version to run tests on' + required: false + default: '8.1' + type: string jobs: build: @@ -24,7 +30,8 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: ${{ inputs.php-version || '8.1' }} + ini-values: error_reporting=E_ALL, display_errors=On, display_startup_errors=On - name: Setup Apple Pay test certificate run: mkdir certs - run: echo "$APPLE_PAY_MERCHANT_ID_CERT" > certs/merchant_id.pem diff --git a/composer.json b/composer.json index 6e891cc6..7a6a2a7b 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": ">6.5 <10.0", + "phpunit/phpunit": "^9.6", "friendsofphp/php-cs-fixer": "^3.0" }, "suggest": { diff --git a/phpunit.xml b/phpunit.xml index df900576..b89b9dd1 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,6 +7,7 @@ convertErrorsToExceptions="true" convertNoticesToExceptions="false" convertWarningsToExceptions="false" + convertDeprecationsToExceptions="true" processIsolation="false" stopOnFailure="false" verbose="true" From 3c69df3670606acb1d89018b655e3a833ccfaa6a Mon Sep 17 00:00:00 2001 From: "david.owusu" Date: Wed, 18 Feb 2026 13:14:01 +0100 Subject: [PATCH 4/5] [CC-3237] Remove deprecated(redundant) method calls. - `curl_close` - `\ReflectionMethod::setAccessible` --- src/Adapter/ApplepayAdapter.php | 9 --------- src/Adapter/CurlAdapter.php | 8 -------- src/Adapter/HttpAdapterInterface.php | 5 ----- src/Services/HttpService.php | 1 - test/unit/Services/CancelServiceTest.php | 3 +-- test/unit/Services/DummyAdapter.php | 8 -------- test/unit/Services/HttpServiceTest.php | 1 - 7 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/Adapter/ApplepayAdapter.php b/src/Adapter/ApplepayAdapter.php index b23a4636..820655cf 100644 --- a/src/Adapter/ApplepayAdapter.php +++ b/src/Adapter/ApplepayAdapter.php @@ -42,7 +42,6 @@ public function validateApplePayMerchant( $this->setOption(CURLOPT_POSTFIELDS, $payload); $sessionResponse = $this->execute(); - $this->close(); return $sessionResponse; } @@ -131,14 +130,6 @@ public function execute(): ?string throw new ApplepayMerchantValidationException($errorMessage); } - /** - * @inheritDoc - */ - public function close(): void - { - curl_close($this->request); - } - /** * @inheritDoc */ diff --git a/src/Adapter/CurlAdapter.php b/src/Adapter/CurlAdapter.php index 5535eb40..43a781ee 100755 --- a/src/Adapter/CurlAdapter.php +++ b/src/Adapter/CurlAdapter.php @@ -95,14 +95,6 @@ public function getResponseCode(): string return curl_getinfo($this->request, CURLINFO_HTTP_CODE); } - /** - * {@inheritDoc} - */ - public function close(): void - { - curl_close($this->request); - } - /** * {@inheritDoc} */ diff --git a/src/Adapter/HttpAdapterInterface.php b/src/Adapter/HttpAdapterInterface.php index 2e2bd0a6..be80576c 100755 --- a/src/Adapter/HttpAdapterInterface.php +++ b/src/Adapter/HttpAdapterInterface.php @@ -43,11 +43,6 @@ public function execute(): ?string; */ public function getResponseCode(): string; - /** - * Closes the connection of the request. - */ - public function close(): void; - /** * Sets the headers for the request. * Expects an associative array with $key being the header name and $value being the header value. diff --git a/src/Services/HttpService.php b/src/Services/HttpService.php index cce644cb..68bcdc0c 100755 --- a/src/Services/HttpService.php +++ b/src/Services/HttpService.php @@ -135,7 +135,6 @@ public function sendRequest(ApiRequest $request): string $httpAdapter = $this->getAdapter(); $response = $httpAdapter->execute(); $responseCode = $httpAdapter->getResponseCode(); - $httpAdapter->close(); // handle response try { diff --git a/test/unit/Services/CancelServiceTest.php b/test/unit/Services/CancelServiceTest.php index 8b56bfd2..a2a6ab60 100644 --- a/test/unit/Services/CancelServiceTest.php +++ b/test/unit/Services/CancelServiceTest.php @@ -11,6 +11,7 @@ namespace UnzerSDK\test\unit\Services; +use PHPUnit\Framework\MockObject\MockObject; use UnzerSDK\Constants\ApiResponseCodes; use UnzerSDK\Exceptions\UnzerApiException; use UnzerSDK\Resources\EmbeddedResources\Amount; @@ -24,7 +25,6 @@ use UnzerSDK\Services\CancelService; use UnzerSDK\Services\ResourceService; use UnzerSDK\test\BasePaymentTest; -use PHPUnit\Framework\MockObject\MockObject; class CancelServiceTest extends BasePaymentTest { @@ -119,7 +119,6 @@ public function maxCancelAmountShouldBeRoundedCorrectly(): void $cancelSrvMock = new CancelService($this->unzer); $reflection = new \ReflectionClass(get_class($cancelSrvMock)); $method = $reflection->getMethod('calculateMaxReversalAmount'); - $method->setAccessible(true); $chargeAmount = 12.3; $receiptAmount = 10.0; diff --git a/test/unit/Services/DummyAdapter.php b/test/unit/Services/DummyAdapter.php index a3778708..7ed18f26 100755 --- a/test/unit/Services/DummyAdapter.php +++ b/test/unit/Services/DummyAdapter.php @@ -39,14 +39,6 @@ public function getResponseCode(): string return 'responseCode'; } - /** - * {@inheritDoc} - */ - public function close(): void - { - // do nothing - } - /** * {@inheritDoc} */ diff --git a/test/unit/Services/HttpServiceTest.php b/test/unit/Services/HttpServiceTest.php index 8892f32e..816b43fe 100755 --- a/test/unit/Services/HttpServiceTest.php +++ b/test/unit/Services/HttpServiceTest.php @@ -112,7 +112,6 @@ static function ($url) { $adapterMock->expects($this->once())->method('setHeaders')->with($headers); $adapterMock->expects($this->once())->method('execute')->willReturn('myResponseString'); $adapterMock->expects($this->once())->method('getResponseCode')->willReturn('399'); - $adapterMock->expects($this->once())->method('close'); $httpServiceMock->method('getAdapter')->willReturn($adapterMock); From 2d76d2b9170d4e83cd2a51649ca6cd7f06a975c2 Mon Sep 17 00:00:00 2001 From: "david.owusu" Date: Wed, 18 Feb 2026 13:27:01 +0100 Subject: [PATCH 5/5] [CC-3237] Add test report. --- .github/workflows/integration-tests.yml | 13 ++++++++++++- .github/workflows/unit-tests.yml | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 306d576a..d1643e6c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -15,6 +15,9 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + checks: write name: integration tests env: UNZER_PAPI_TEST_PRIVATE_KEY_DEFAULT: ${{ secrets.PAPI_PRIVATE_KEY_DEFAULT }} @@ -40,4 +43,12 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress - name: Run integration tests - run: php ./vendor/bin/phpunit test/integration + run: php ./vendor/bin/phpunit --log-junit test-results/junit.xml test/integration + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + if: always() + with: + report_paths: 'test-results/junit.xml' + check_name: 'Integration Test Report' + detailed_summary: true + fail_on_failure: true diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index b89821f0..90b28cec 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -8,6 +8,9 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + checks: write strategy: matrix: php: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] @@ -22,4 +25,12 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress - name: Run unit tests - run: php ./vendor/bin/phpunit test/unit + run: php ./vendor/bin/phpunit --log-junit test-results/junit-${{ matrix.php }}.xml test/unit + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + if: failure() + with: + report_paths: 'test-results/junit-${{ matrix.php }}.xml' + check_name: 'Unit Test Report (PHP ${{ matrix.php }})' + detailed_summary: true + fail_on_failure: true