Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ on:
branches:
- 'main'
workflow_dispatch:
inputs:
php-version:
description: 'PHP version to run tests on'
required: false
default: '8.1'
type: string

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 }}
Expand All @@ -24,7 +33,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
Expand All @@ -33,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
16 changes: 14 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
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
- name: Setup PHP
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
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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"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": {
"phpunit/phpunit": ">6.5 <10.0",
"phpunit/phpunit": "^9.6",
"friendsofphp/php-cs-fixer": "^3.0"
},
"suggest": {
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="false"
convertWarningsToExceptions="false"
convertDeprecationsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
Expand Down
9 changes: 0 additions & 9 deletions src/Adapter/ApplepayAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function validateApplePayMerchant(
$this->setOption(CURLOPT_POSTFIELDS, $payload);

$sessionResponse = $this->execute();
$this->close();
return $sessionResponse;
}

Expand Down Expand Up @@ -131,14 +130,6 @@ public function execute(): ?string
throw new ApplepayMerchantValidationException($errorMessage);
}

/**
* @inheritDoc
*/
public function close(): void
{
curl_close($this->request);
Copy link
Copy Markdown
Contributor Author

@Ryouzanpaku Ryouzanpaku Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curl_close got removed because it is deprecated and did not do anything from php 8.0 onwards.

}

/**
* @inheritDoc
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Adapter/CurlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/HttpAdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion src/Services/HttpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public function sendRequest(ApiRequest $request): string
$httpAdapter = $this->getAdapter();
$response = $httpAdapter->execute();
$responseCode = $httpAdapter->getResponseCode();
$httpAdapter->close();

// handle response
try {
Expand Down
3 changes: 1 addition & 2 deletions test/unit/Services/CancelServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions test/unit/Services/DummyAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ public function getResponseCode(): string
return 'responseCode';
}

/**
* {@inheritDoc}
*/
public function close(): void
{
// do nothing
}

/**
* {@inheritDoc}
*/
Expand Down
1 change: 0 additions & 1 deletion test/unit/Services/HttpServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down