Skip to content

Commit 7998346

Browse files
committed
Updated dependencies
1 parent 8983326 commit 7998346

11 files changed

+71
-86
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ jobs:
189189
run: "composer update --prefer-dist --no-interaction --no-progress --no-suggest"
190190

191191
- name: "Tests"
192-
run: "composer run check:tests"
192+
run: "composer run check:tests-coverage"
193193

194194
- name: "Upload to Codecov.io"
195195
env:

composer.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"ext-curl": "*",
2323
"guzzlehttp/guzzle": "^6.4.1 || ^7.0.1",
2424
"php-parallel-lint/php-parallel-lint": "^1.3.1",
25-
"phpstan/phpstan": "^1.7.15",
26-
"phpstan/phpstan-phpunit": "^1.1.1",
27-
"phpstan/phpstan-strict-rules": "^1.2.3",
28-
"phpunit/phpunit": "^9.5.21",
25+
"phpstan/phpstan": "^2.0.2",
26+
"phpstan/phpstan-phpunit": "^2.0.1",
27+
"phpstan/phpstan-strict-rules": "^2.0.0",
28+
"phpunit/phpunit": "^10.5.38",
2929
"psr/log": "^3.0.0",
3030
"slevomat/coding-standard": "^8.0.0",
3131
"squizlabs/php_codesniffer": "^3.7.1"
@@ -38,7 +38,8 @@
3838
"@check:types",
3939
"@check:tests"
4040
],
41-
"check:tests": "php ./vendor/phpunit/phpunit/phpunit -d memory_limit=512M --configuration tests/phpunit.xml tests",
41+
"check:tests-coverage": "php ./vendor/phpunit/phpunit/phpunit -d memory_limit=512M --configuration tests/phpunit.xml tests",
42+
"check:tests": "@check:tests-coverage --no-coverage",
4243
"check:cs": "php ./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=build --extensions=php --encoding=utf-8 --tab-width=4 -sp src tests",
4344
"fix:cs": "php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --standard=build --extensions=php --encoding=utf-8 --tab-width=4 -sp src tests",
4445
"check:lint": "php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint src tests",

src/AdditionalData/OrderAddress.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public function __construct(
3131
if ($this->address3 !== null) {
3232
Validator::checkWhitespacesAndLength($this->address3, self::ADDRESS_LENGTH_MAX);
3333
}
34-
if ($this->city !== null) {
35-
Validator::checkWhitespacesAndLength($this->city, self::ADDRESS_LENGTH_MAX);
36-
}
34+
Validator::checkWhitespacesAndLength($this->city, self::ADDRESS_LENGTH_MAX);
3735
Validator::checkWhitespacesAndLength($this->zip, self::ZIP_LENGTH_MAX);
3836
}
3937

src/Api/Driver/CurlDriver.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use const CURLOPT_RETURNTRANSFER;
2424
use const CURLOPT_SSL_VERIFYPEER;
2525
use const CURLOPT_TIMEOUT;
26-
use const PHP_VERSION_ID;
2726

2827
class CurlDriver implements ApiClientDriver
2928
{
@@ -46,7 +45,7 @@ public function request(HttpMethod $method, string $url, ?array $data, array $he
4645

4746
if ($method === HttpMethod::POST || $method === HttpMethod::PUT) {
4847
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method->value);
49-
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
48+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_THROW_ON_ERROR));
5049
}
5150

5251
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
@@ -69,10 +68,6 @@ public function request(HttpMethod $method, string $url, ?array $data, array $he
6968
$body = substr((string) $output, $headerSize);
7069

7170
$responseCode = ResponseCode::from(curl_getinfo($ch, CURLINFO_HTTP_CODE));
72-
if (PHP_VERSION_ID < 80000) {
73-
curl_close($ch);
74-
}
75-
7671
return new Response(
7772
$responseCode,
7873
json_decode($body, true),

src/Crypto/CryptoService.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use function base64_encode;
77
use function file_get_contents;
88
use const OPENSSL_ALGO_SHA256;
9-
use const PHP_VERSION_ID;
109

1110
class CryptoService
1211
{
@@ -46,13 +45,7 @@ public function signData(array $data, SignatureDataFormatter $signatureDataForma
4645
throw new SigningFailedException($data);
4746
}
4847

49-
$signature = base64_encode($signature);
50-
if (PHP_VERSION_ID < 80000) {
51-
// phpcs:ignore Generic.PHP.DeprecatedFunctions
52-
openssl_free_key($privateKeyId);
53-
}
54-
55-
return $signature;
48+
return base64_encode($signature);
5649
}
5750

5851
/**
@@ -77,10 +70,6 @@ public function verifyData(array $data, string $signature, SignatureDataFormatte
7770
}
7871

7972
$verifyResult = openssl_verify($message, $signature, $publicKeyId, self::HASH_METHOD);
80-
if (PHP_VERSION_ID < 80000) {
81-
// phpcs:ignore Generic.PHP.DeprecatedFunctions
82-
openssl_free_key($publicKeyId);
83-
}
8473
if ($verifyResult === -1) {
8574
throw new VerificationFailedException($data, (string) openssl_error_string());
8675
}

tests/phpunit.xml

+31-28
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
<?xml version="1.0"?>
22
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
bootstrap="bootstrap.php"
5-
colors="true"
6-
backupGlobals="false"
7-
backupStaticAttributes="false"
8-
beStrictAboutTestsThatDoNotTestAnything="true"
9-
beStrictAboutCoversAnnotation="true"
10-
beStrictAboutOutputDuringTests="true"
11-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
12-
failOnRisky="true"
13-
convertDeprecationsToExceptions="true"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="bootstrap.php"
5+
colors="true"
6+
beStrictAboutCoverageMetadata="true"
7+
beStrictAboutOutputDuringTests="true"
8+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
9+
failOnRisky="true"
10+
displayDetailsOnTestsThatTriggerWarnings="true"
11+
displayDetailsOnTestsThatTriggerDeprecations="true"
12+
displayDetailsOnTestsThatTriggerErrors="true"
13+
displayDetailsOnTestsThatTriggerNotices="true"
14+
displayDetailsOnPhpunitDeprecations="true"
1415
>
15-
<coverage processUncoveredFiles="true">
16-
<include>
17-
<directory suffix=".php">../src</directory>
18-
</include>
19-
<report>
20-
<clover outputFile="../build/log/clover.xml"/>
21-
<html outputDirectory="../build/log/html" lowUpperBound="0" highLowerBound="99"/>
22-
<text outputFile="php://stdout" showUncoveredFiles="true" showOnlySummary="true"/>
23-
</report>
24-
</coverage>
25-
<logging/>
26-
<testsuites>
27-
<testsuite name="Unit_Tests">
28-
<directory>unit</directory>
29-
</testsuite>
30-
</testsuites>
16+
<source>
17+
<include>
18+
<directory>../src</directory>
19+
</include>
20+
</source>
21+
<coverage>
22+
<report>
23+
<clover outputFile="../build/log/clover.xml"/>
24+
<html outputDirectory="../build/log/html" lowUpperBound="0" highLowerBound="99"/>
25+
<text outputFile="php://stdout" showUncoveredFiles="true" showOnlySummary="true"/>
26+
</report>
27+
</coverage>
28+
<logging/>
29+
<testsuites>
30+
<testsuite name="Unit_Tests">
31+
<directory>unit</directory>
32+
</testsuite>
33+
</testsuites>
3134
<php>
32-
<ini name="error_reporting" value="E_ALL" />
35+
<ini name="error_reporting" value="E_ALL"/>
3336
</php>
3437
</phpunit>

tests/unit/Api/ApiClientTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ApiClientTest extends TestCase
2020
/**
2121
* @return mixed[]
2222
*/
23-
public function getRequests(): array
23+
public static function getRequests(): array
2424
{
2525
return [
2626
[
@@ -200,7 +200,7 @@ public function testRequests(
200200
/**
201201
* @return mixed[]
202202
*/
203-
public function getTestExceptions(): array
203+
public static function getTestExceptions(): array
204204
{
205205
return [
206206
[

tests/unit/Call/Extension/TransactionSettlementExtensionTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace SlevomatCsobGateway\Call\Extension;
44

5-
use DateTimeImmutable;
65
use PHPUnit\Framework\TestCase;
76

87
class TransactionSettlementExtensionTest extends TestCase
@@ -18,11 +17,11 @@ public function testCreateResponse(): void
1817
]);
1918

2019
self::assertSame('2016-04-12 12:06:20 848000', $transactionSettlementResponse->getCreatedDate()->format('Y-m-d H:i:s u'));
21-
/** @var DateTimeImmutable $authDate */
20+
2221
$authDate = $transactionSettlementResponse->getAuthDate();
2322
self::assertNotNull($authDate);
2423
self::assertSame('2016-04-12 10:06:35', $authDate->format('Y-m-d H:i:s'));
25-
/** @var DateTimeImmutable $settlementDate */
24+
2625
$settlementDate = $transactionSettlementResponse->getSettlementDate();
2726
self::assertNotNull($settlementDate);
2827
self::assertSame('2016-04-12', $settlementDate->format('Y-m-d'));

tests/unit/Crypto/CryptoServiceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function setUp(): void
2020
/**
2121
* @return mixed[]
2222
*/
23-
public function getSignDataData(): array
23+
public static function getSignDataData(): array
2424
{
2525
return [
2626
[

tests/unit/Crypto/SignatureDataFormatterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class SignatureDataFormatterTest extends TestCase
1010
/**
1111
* @return mixed[]
1212
*/
13-
public function getFormatDataForSignatureData(): array
13+
public static function getFormatDataForSignatureData(): array
1414
{
1515
return [
1616
[

0 commit comments

Comments
 (0)