From 804a7932b183768cd982fadbc853231d4162d068 Mon Sep 17 00:00:00 2001 From: "a.dmitryuk" Date: Wed, 6 Mar 2024 14:48:03 +0500 Subject: [PATCH 1/4] PhpUnit 11 support --- .gitattributes | 1 + .github/workflows/php.yml | 6 ++++-- composer.json | 4 ++-- phpunit.xml | 24 ++++++++++++----------- tests/Functional/JsonValueMatchesTest.php | 5 +++++ 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.gitattributes b/.gitattributes index b6d55ad..8508be4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,7 @@ .gitattributes export-ignore .codeclimate.yml export-ignore +.github export-ignore .gitignore export-ignore .travis.yml export-ignore phpunit.xml export-ignore diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 5287744..bfeb078 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -12,11 +12,13 @@ jobs: build: strategy: matrix: - php: ['8.0', '8.1', '8.2'] - phpunit: ['8.0', '9.0', '10.0'] + php: ['8.0', '8.1', '8.2', '8.3'] + phpunit: ['8.0', '9.0', '10.0', '11.0'] exclude: - php: '8.0' phpunit: '10.0' + - php: '8.0' + phpunit: '11.0' runs-on: ubuntu-latest name: PHP ${{ matrix.php }}, PHPUnit ${{ matrix.phpunit }} diff --git a/composer.json b/composer.json index 3c1ec93..ba6b57d 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,10 @@ "justinrainbow/json-schema": "^5.0" }, "conflict": { - "phpunit/phpunit": "<8.0 || >= 11.0" + "phpunit/phpunit": "<8.0 || >= 12.0" }, "require-dev": { - "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0 || ^11.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 5c0ce0d..a071790 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,7 @@ - - tests/Functional - + + tests/Functional + - + - - src - - - - + + + + + + src + + diff --git a/tests/Functional/JsonValueMatchesTest.php b/tests/Functional/JsonValueMatchesTest.php index 26503a0..a5a2da4 100644 --- a/tests/Functional/JsonValueMatchesTest.php +++ b/tests/Functional/JsonValueMatchesTest.php @@ -3,6 +3,7 @@ use Helmich\JsonAssert\JsonAssertions; use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Constraint\Count; use PHPUnit\Framework\Constraint\IsEqual; use PHPUnit\Framework\Constraint\IsType; @@ -83,6 +84,7 @@ public static function dataForJsonValueEqualsCanFail() * @param $expectedValue * @dataProvider dataForJsonValueEquals */ + #[DataProvider('dataForJsonValueEquals')] public function testJsonValueEqualsCanSucceed($jsonDocument, $jsonPath, $expectedValue) { $this->assertJsonValueEquals($jsonDocument, $jsonPath, $expectedValue); @@ -94,6 +96,7 @@ public function testJsonValueEqualsCanSucceed($jsonDocument, $jsonPath, $expecte * @param $expectedValue * @dataProvider dataForJsonValueEqualsCanFail */ + #[DataProvider('dataForJsonValueEqualsCanFail')] public function testJsonValueEqualsCanFail($jsonDocument, $jsonPath, $expectedValue) { $this->expectException(AssertionFailedError::class); @@ -107,6 +110,7 @@ public function testJsonValueEqualsCanFail($jsonDocument, $jsonPath, $expectedVa * @param $expectedValue * @dataProvider dataForJsonValueEquals */ + #[DataProvider('dataForJsonValueEquals')] public function testJsonValueMatchesCanSucceed($jsonDocument, $jsonPath, $expectedValue) { $this->assertJsonValueMatches( @@ -131,6 +135,7 @@ public function testJsonValueMatchesSucceedsWithAnyConstraint() * @param $expectedValue * @dataProvider dataForJsonValueEqualsCanFail */ + #[DataProvider('dataForJsonValueEqualsCanFail')] public function testJsonValueMatchesCanFail($jsonDocument, $jsonPath, $expectedValue) { $this->expectException(AssertionFailedError::class); From aa6d8e91ecb5443068bf2bcfbd0319b4c9fa5b96 Mon Sep 17 00:00:00 2001 From: "a.dmitryuk" Date: Wed, 6 Mar 2024 14:50:39 +0500 Subject: [PATCH 2/4] review --- .github/workflows/php.yml | 2 ++ .github/workflows/php_coverage.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index bfeb078..781ade6 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -17,6 +17,8 @@ jobs: exclude: - php: '8.0' phpunit: '10.0' + - php: '8.1' + phpunit: '11.0' - php: '8.0' phpunit: '11.0' runs-on: ubuntu-latest diff --git a/.github/workflows/php_coverage.yml b/.github/workflows/php_coverage.yml index aa8d8c1..5c30db8 100644 --- a/.github/workflows/php_coverage.yml +++ b/.github/workflows/php_coverage.yml @@ -14,7 +14,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.3 extensions: mbstring, intl, json coverage: pcov From 5418252a4028a5a8cbf826eff6f831863da959be Mon Sep 17 00:00:00 2001 From: "a.dmitryuk" Date: Wed, 6 Mar 2024 15:02:35 +0500 Subject: [PATCH 3/4] readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 281c863..03255cc 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 | 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: | +| "JSON assertion" version | PHPUnit 4 | PHPUnit 5 | PHPUnit 6 | PHPUnit 7 | PHPUnit 8 | PHPUnit 9 | PHPUnit 10 | PHPUnit 11 | +| ------------------------ | --------- | --------- | --------- | --------- | --------- | --------- | ---------- |------------| +| 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: | :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: | :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: | :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. From 59ccd936be52488963d7ed69e80ae22e6d2b6c5c Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Mon, 20 May 2024 13:11:30 +0200 Subject: [PATCH 4/4] Empty commit to trigger CI pipeline (will be squashed away)