From 184d1338623864ab8b82239e18a25421c5a57368 Mon Sep 17 00:00:00 2001 From: Martin Parsiegla Date: Mon, 23 Feb 2026 15:37:51 +0100 Subject: [PATCH] Add support for PHPUnit 13.x The new version was released a few weeks ago (see https://phpunit.de/announcements/phpunit-13.html), so I made some adjustments to allow using this one as well. Nothing major changed, so the main thing to do was adjusting the composer dependencies and the CI pipeline. --- .github/workflows/php.yml | 8 +++++++- README.md | 10 +++++----- composer.json | 4 ++-- tests/Functional/JsonValueMatchesTest.php | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 9661e99..772c80e 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -13,14 +13,20 @@ jobs: strategy: matrix: php: ['8.2', '8.3', '8.4', '8.5'] - phpunit: ['8.0', '9.0', '10.0', '11.0', '12.0'] + phpunit: ['8.0', '9.0', '10.0', '11.0', '12.0', '13.0'] exclude: - php: '8.1' phpunit: '11.0' - php: '8.1' phpunit: '12.0' + - php: '8.1' + phpunit: '13.0' - php: '8.2' phpunit: '12.0' + - php: '8.2' + phpunit: '13.0' + - php: '8.3' + phpunit: '13.0' runs-on: ubuntu-latest name: PHP ${{ matrix.php }}, PHPUnit ${{ matrix.phpunit }} diff --git a/README.md b/README.md index a1aecef..6bb977a 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,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 | PHPUnit 11 | PHPUnit 12 | -| ------------------------ | --------- | --------- | --------- | --------- | --------- | --------- | ---------- |------------|------------| -| 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: | :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: | :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: | :white_check_mark: | +| "JSON assertion" version | PHPUnit 4 | PHPUnit 5 | PHPUnit 6 | PHPUnit 7 | PHPUnit 8 | PHPUnit 9 | PHPUnit 10 | PHPUnit 11 | PHPUnit 12 | PHPUnit 13 | +| ------------------------ | --------- | --------- | --------- | --------- | --------- | --------- | ---------- |------------|------------|------------| +| 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: | :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: | :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: | :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 61af645..ef7ed8b 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,10 @@ "justinrainbow/json-schema": "^5.0 || ^6.0" }, "conflict": { - "phpunit/phpunit": "<8.0 || >= 13.0" + "phpunit/phpunit": "<8.0 || >= 14.0" }, "require-dev": { - "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0" + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0" }, "autoload": { "psr-4": { diff --git a/tests/Functional/JsonValueMatchesTest.php b/tests/Functional/JsonValueMatchesTest.php index be40b86..3fd08e8 100644 --- a/tests/Functional/JsonValueMatchesTest.php +++ b/tests/Functional/JsonValueMatchesTest.php @@ -127,9 +127,9 @@ public function testJsonValueMatchesSucceedsWithAnyConstraint() { $type = 'array'; - // Required for PHPUnit 12 support as starting from PHPUnit + // Required for PHPUnit > 12 support as starting from PHPUnit // version 12 IsTypeclass expects an enum of NativeType. - if (str_starts_with(Version::id(), '12.')) { + if (version_compare(Version::id(), '12', 'ge')) { $type = NativeType::Array; }