From 5a3a53e46f4d1f1b324c5cc2e33d87ad2d37260c Mon Sep 17 00:00:00 2001 From: Martins Sipenko Date: Fri, 3 Mar 2023 16:09:38 +0200 Subject: [PATCH] Add support for PHPUnit 10 (#52) * Add support for PHPunit 10 * Don't test PHPunit 10 on PHP < 8.1 * Fix CI * Update PHPUnit config --- .github/workflows/php.yml | 10 +++++---- README.md | 10 ++++----- composer.json | 4 ++-- phpunit.xml | 25 +++++++++++------------ tests/Functional/JsonValueMatchesTest.php | 4 ++-- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 53f377a..5287744 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -13,8 +13,10 @@ jobs: strategy: matrix: php: ['8.0', '8.1', '8.2'] - phpunit: ['8.0', '9.0'] - composer-arg: [''] + phpunit: ['8.0', '9.0', '10.0'] + exclude: + - php: '8.0' + phpunit: '10.0' runs-on: ubuntu-latest name: PHP ${{ matrix.php }}, PHPUnit ${{ matrix.phpunit }} @@ -37,10 +39,10 @@ jobs: composer require --no-update --dev phpunit/phpunit ~${{ matrix.phpunit }} - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest --${{ matrix.composer-arg }} + run: composer install --prefer-dist --no-progress --no-suggest #- name: Run type checker # run: ./vendor/bin/psalm - name: Run unit tests - run: ./vendor/bin/phpunit --testdox + run: ./vendor/bin/phpunit --testdox --no-coverage diff --git a/README.md b/README.md index 0228e3c..281c863 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,11 @@ This library is [MIT-licensed](LICENSE.txt). There are several release branches of this library, each of these being compatible with different releases of PHPUnit and PHP. The following table should give an easy overview: -| "JSON assertion" version | PHPUnit 4 | PHPUnit 5 | PHPUnit 6 | PHPUnit 7 | PHPUnit 8 | PHPUnit 9 | -| ------------------------ | --------- | --------- | --------- | --------- | --------- | --------- | -| v1 (branch `v1`), **unsupported** | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | -| v2 (branch `v2`) | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | -| v3 (branch `master`) | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :white_check_mark: | +| "JSON assertion" version | PHPUnit 4 | PHPUnit 5 | PHPUnit 6 | PHPUnit 7 | PHPUnit 8 | PHPUnit 9 | PHPUnit 10 | +| ------------------------ | --------- | --------- | --------- | --------- | --------- | --------- | ---------- | +| v1 (branch `v1`), **unsupported** | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | +| v2 (branch `v2`) | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | +| v3 (branch `master`) | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | When you are using `composer require` and have already declared a dependency to `phpunit/phpunit` in your `composer.json` file, Composer should pick latest compatible version automatically. diff --git a/composer.json b/composer.json index 0b1a1ff..3c1ec93 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,10 @@ "justinrainbow/json-schema": "^5.0" }, "conflict": { - "phpunit/phpunit": "<8.0 || >= 10.0" + "phpunit/phpunit": "<8.0 || >= 11.0" }, "require-dev": { - "phpunit/phpunit": "^8.0 || ^9.0" + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 829a996..5c0ce0d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,28 +1,27 @@ + + timeoutForLargeTests="60" + cacheDirectory=".phpunit.cache"> tests/Functional - - + - - + + src - - + + + + + diff --git a/tests/Functional/JsonValueMatchesTest.php b/tests/Functional/JsonValueMatchesTest.php index d219234..26503a0 100644 --- a/tests/Functional/JsonValueMatchesTest.php +++ b/tests/Functional/JsonValueMatchesTest.php @@ -33,7 +33,7 @@ class JsonValueMatchesTest extends TestCase ], ]; - public function dataForJsonValueEquals() + public static function dataForJsonValueEquals() { $json = static::$exampleDocument; @@ -58,7 +58,7 @@ public function dataForJsonValueEquals() ]; } - public function dataForJsonValueEqualsCanFail() + public static function dataForJsonValueEqualsCanFail() { $json = static::$exampleDocument;