Skip to content

Commit

Permalink
Add support for PHPUnit 10 (#52)
Browse files Browse the repository at this point in the history
* Add support for PHPunit 10

* Don't test PHPunit 10 on PHP < 8.1

* Fix CI

* Update PHPUnit config
  • Loading branch information
martinssipenko authored Mar 3, 2023
1 parent b15f846 commit 5a3a53e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
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 |
| ------------------------ | --------- | --------- | --------- | --------- | --------- | --------- |
| 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.

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 || >= 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": {
Expand Down
25 changes: 12 additions & 13 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.1/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertDeprecationsToExceptions="true"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60">
timeoutForLargeTests="60"
cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="functional">
<directory>tests/Functional</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="build/coverage" lowUpperBound="35"
highLowerBound="70"/>
<log type="junit" target="build/phpunit"/>
<junit outputFile="build/phpunit"/>
</logging>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<coverage>
<include>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</include>
<report>
<html outputDirectory="build/coverage" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
</phpunit>
4 changes: 2 additions & 2 deletions tests/Functional/JsonValueMatchesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class JsonValueMatchesTest extends TestCase
],
];

public function dataForJsonValueEquals()
public static function dataForJsonValueEquals()
{
$json = static::$exampleDocument;

Expand All @@ -58,7 +58,7 @@ public function dataForJsonValueEquals()
];
}

public function dataForJsonValueEqualsCanFail()
public static function dataForJsonValueEqualsCanFail()
{
$json = static::$exampleDocument;

Expand Down

0 comments on commit 5a3a53e

Please sign in to comment.