Skip to content

Commit

Permalink
PHPUnit 11 support (#55)
Browse files Browse the repository at this point in the history
* PhpUnit 11 support

* review

* readme

* Empty commit to trigger CI pipeline (will be squashed away)

---------

Co-authored-by: a.dmitryuk <[email protected]>
Co-authored-by: Martin Helmich <[email protected]>
  • Loading branch information
3 people authored May 20, 2024
1 parent 5a3a53e commit 2ac7612
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ 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.1'
phpunit: '11.0'
- php: '8.0'
phpunit: '11.0'
runs-on: ubuntu-latest
name: PHP ${{ matrix.php }}, PHPUnit ${{ matrix.phpunit }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
24 changes: 13 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="functional">
<directory>tests/Functional</directory>
</testsuite>
<testsuite name="functional">
<directory>tests/Functional</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/phpunit"/>
<junit outputFile="build/phpunit"/>
</logging>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<html outputDirectory="build/coverage" lowUpperBound="35" highLowerBound="70"/>
</report>
<report>
<html outputDirectory="build/coverage" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
5 changes: 5 additions & 0 deletions tests/Functional/JsonValueMatchesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -107,6 +110,7 @@ public function testJsonValueEqualsCanFail($jsonDocument, $jsonPath, $expectedVa
* @param $expectedValue
* @dataProvider dataForJsonValueEquals
*/
#[DataProvider('dataForJsonValueEquals')]
public function testJsonValueMatchesCanSucceed($jsonDocument, $jsonPath, $expectedValue)
{
$this->assertJsonValueMatches(
Expand All @@ -131,6 +135,7 @@ public function testJsonValueMatchesSucceedsWithAnyConstraint()
* @param $expectedValue
* @dataProvider dataForJsonValueEqualsCanFail
*/
#[DataProvider('dataForJsonValueEqualsCanFail')]
public function testJsonValueMatchesCanFail($jsonDocument, $jsonPath, $expectedValue)
{
$this->expectException(AssertionFailedError::class);
Expand Down

0 comments on commit 2ac7612

Please sign in to comment.