From 6c6418b60832f3d03959b414d38de59195ebc823 Mon Sep 17 00:00:00 2001 From: Gustavo Freze Date: Mon, 12 Feb 2024 14:24:35 -0300 Subject: [PATCH] fix: Fixes test and build execution for the GitHub workflow. (#27) --- .github/workflows/ci.yml | 10 ++++++++++ .gitignore | 9 +++++---- composer.json | 4 ++-- phpunit.xml | 30 ++++++++++++++++++++---------- tests/HttpCodeTest.php | 4 ++-- tests/HttpResponseTest.php | 2 +- 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32850ac..105bc90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Use PHP 8.2 + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + - name: Install dependencies run: composer update --no-progress --optimize-autoloader @@ -33,6 +38,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Use PHP 8.2 + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + - name: Install dependencies run: composer update --no-progress --optimize-autoloader diff --git a/.gitignore b/.gitignore index bd34b23..3333ef2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea -vendor -report -composer.lock -.phpunit.result.cache \ No newline at end of file + +/vendor/ +/report +*.lock +.phpunit.* diff --git a/composer.json b/composer.json index b07c413..526f5ba 100644 --- a/composer.json +++ b/composer.json @@ -42,14 +42,14 @@ }, "require": { "php": "^8.2", - "tiny-blocks/serializer": "^2.0", + "tiny-blocks/serializer": "^3.0", "psr/http-message": "^1.1", "ext-mbstring": "*" }, "require-dev": { "infection/infection": "^0.27", "phpmd/phpmd": "^2.15", - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^10", "squizlabs/php_codesniffer": "^3.8" }, "suggest": { diff --git a/phpunit.xml b/phpunit.xml index 3d05fc8..a325068 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,25 +1,35 @@ + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" + cacheDirectory=".phpunit.cache" + backupStaticProperties="false"> + + + + + + + + + tests - + + + + + src - + + diff --git a/tests/HttpCodeTest.php b/tests/HttpCodeTest.php index d56d907..8dfcb76 100644 --- a/tests/HttpCodeTest.php +++ b/tests/HttpCodeTest.php @@ -26,7 +26,7 @@ public function testIsHttpCode(int $httpCode, bool $expected): void self::assertEquals($expected, $actual); } - public function providerForTestMessage(): array + public static function providerForTestMessage(): array { return [ [ @@ -64,7 +64,7 @@ public function providerForTestMessage(): array ]; } - public function providerForTestIsHttpCode(): array + public static function providerForTestIsHttpCode(): array { return [ [ diff --git a/tests/HttpResponseTest.php b/tests/HttpResponseTest.php index f9e4f13..780756a 100644 --- a/tests/HttpResponseTest.php +++ b/tests/HttpResponseTest.php @@ -117,7 +117,7 @@ public function testResponseInternalServerError(mixed $data, mixed $expected): v self::assertEquals($this->defaultHeaderFrom(code: HttpCode::INTERNAL_SERVER_ERROR), $response->getHeaders()); } - public function providerData(): array + public static function providerData(): array { return [ [