Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
janlanger committed Nov 25, 2024
1 parent e405425 commit bdb4874
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ jobs:
run: "composer update --prefer-dist --no-interaction --no-progress --no-suggest"

- name: "Tests"
run: "composer run check:tests"
run: "composer run check:tests-coverage"

- name: "Upload to Codecov.io"
env:
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"ext-curl": "*",
"guzzlehttp/guzzle": "^6.4.1 || ^7.0.1",
"php-parallel-lint/php-parallel-lint": "^1.3.1",
"phpstan/phpstan": "^1.7.15",
"phpstan/phpstan-phpunit": "^1.1.1",
"phpstan/phpstan-strict-rules": "^1.2.3",
"phpunit/phpunit": "^9.5.21",
"phpstan/phpstan": "^2.0.2",
"phpstan/phpstan-phpunit": "^2.0.1",
"phpstan/phpstan-strict-rules": "^2.0.0",
"phpunit/phpunit": "^10.5.38",
"psr/log": "^3.0.0",
"slevomat/coding-standard": "^8.0.0",
"squizlabs/php_codesniffer": "^3.7.1"
Expand All @@ -38,7 +38,8 @@
"@check:types",
"@check:tests"
],
"check:tests": "php ./vendor/phpunit/phpunit/phpunit -d memory_limit=512M --configuration tests/phpunit.xml tests",
"check:tests-coverage": "php ./vendor/phpunit/phpunit/phpunit -d memory_limit=512M --configuration tests/phpunit.xml tests",
"check:tests": "@check:tests-coverage --no-coverage",
"check:cs": "php ./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=build --extensions=php --encoding=utf-8 --tab-width=4 -sp src tests",
"fix:cs": "php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --standard=build --extensions=php --encoding=utf-8 --tab-width=4 -sp src tests",
"check:lint": "php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint src tests",
Expand Down
4 changes: 1 addition & 3 deletions src/AdditionalData/OrderAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public function __construct(
if ($this->address3 !== null) {
Validator::checkWhitespacesAndLength($this->address3, self::ADDRESS_LENGTH_MAX);
}
if ($this->city !== null) {
Validator::checkWhitespacesAndLength($this->city, self::ADDRESS_LENGTH_MAX);
}
Validator::checkWhitespacesAndLength($this->city, self::ADDRESS_LENGTH_MAX);
Validator::checkWhitespacesAndLength($this->zip, self::ZIP_LENGTH_MAX);
}

Expand Down
7 changes: 1 addition & 6 deletions src/Api/Driver/CurlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use const CURLOPT_RETURNTRANSFER;
use const CURLOPT_SSL_VERIFYPEER;
use const CURLOPT_TIMEOUT;
use const PHP_VERSION_ID;

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

if ($method === HttpMethod::POST || $method === HttpMethod::PUT) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method->value);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_THROW_ON_ERROR));
}

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

$responseCode = ResponseCode::from(curl_getinfo($ch, CURLINFO_HTTP_CODE));
if (PHP_VERSION_ID < 80000) {
curl_close($ch);
}

return new Response(
$responseCode,
json_decode($body, true),
Expand Down
13 changes: 1 addition & 12 deletions src/Crypto/CryptoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use function base64_encode;
use function file_get_contents;
use const OPENSSL_ALGO_SHA256;
use const PHP_VERSION_ID;

class CryptoService
{
Expand Down Expand Up @@ -46,13 +45,7 @@ public function signData(array $data, SignatureDataFormatter $signatureDataForma
throw new SigningFailedException($data);
}

$signature = base64_encode($signature);
if (PHP_VERSION_ID < 80000) {
// phpcs:ignore Generic.PHP.DeprecatedFunctions
openssl_free_key($privateKeyId);
}

return $signature;
return base64_encode($signature);
}

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

$verifyResult = openssl_verify($message, $signature, $publicKeyId, self::HASH_METHOD);
if (PHP_VERSION_ID < 80000) {
// phpcs:ignore Generic.PHP.DeprecatedFunctions
openssl_free_key($publicKeyId);
}
if ($verifyResult === -1) {
throw new VerificationFailedException($data, (string) openssl_error_string());
}
Expand Down
59 changes: 31 additions & 28 deletions tests/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="bootstrap.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
failOnRisky="true"
convertDeprecationsToExceptions="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="bootstrap.php"
colors="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
failOnRisky="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnPhpunitDeprecations="true"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">../src</directory>
</include>
<report>
<clover outputFile="../build/log/clover.xml"/>
<html outputDirectory="../build/log/html" lowUpperBound="0" highLowerBound="99"/>
<text outputFile="php://stdout" showUncoveredFiles="true" showOnlySummary="true"/>
</report>
</coverage>
<logging/>
<testsuites>
<testsuite name="Unit_Tests">
<directory>unit</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>../src</directory>
</include>
</source>
<coverage>
<report>
<clover outputFile="../build/log/clover.xml"/>
<html outputDirectory="../build/log/html" lowUpperBound="0" highLowerBound="99"/>
<text outputFile="php://stdout" showUncoveredFiles="true" showOnlySummary="true"/>
</report>
</coverage>
<logging/>
<testsuites>
<testsuite name="Unit_Tests">
<directory>unit</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="E_ALL" />
<ini name="error_reporting" value="E_ALL"/>
</php>
</phpunit>
4 changes: 2 additions & 2 deletions tests/unit/Api/ApiClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ApiClientTest extends TestCase
/**
* @return mixed[]
*/
public function getRequests(): array
public static function getRequests(): array
{
return [
[
Expand Down Expand Up @@ -200,7 +200,7 @@ public function testRequests(
/**
* @return mixed[]
*/
public function getTestExceptions(): array
public static function getTestExceptions(): array
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace SlevomatCsobGateway\Call\Extension;

use DateTimeImmutable;
use PHPUnit\Framework\TestCase;

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

self::assertSame('2016-04-12 12:06:20 848000', $transactionSettlementResponse->getCreatedDate()->format('Y-m-d H:i:s u'));
/** @var DateTimeImmutable $authDate */

$authDate = $transactionSettlementResponse->getAuthDate();
self::assertNotNull($authDate);
self::assertSame('2016-04-12 10:06:35', $authDate->format('Y-m-d H:i:s'));
/** @var DateTimeImmutable $settlementDate */

$settlementDate = $transactionSettlementResponse->getSettlementDate();
self::assertNotNull($settlementDate);
self::assertSame('2016-04-12', $settlementDate->format('Y-m-d'));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Crypto/CryptoServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function setUp(): void
/**
* @return mixed[]
*/
public function getSignDataData(): array
public static function getSignDataData(): array
{
return [
[
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Crypto/SignatureDataFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SignatureDataFormatterTest extends TestCase
/**
* @return mixed[]
*/
public function getFormatDataForSignatureData(): array
public static function getFormatDataForSignatureData(): array
{
return [
[
Expand Down
Loading

0 comments on commit bdb4874

Please sign in to comment.