Skip to content

Commit

Permalink
Composer/GH Actions: allow for PHPUnit 12.x
Browse files Browse the repository at this point in the history
PHPUnit 12.0 has been released today.

As the PHPUnit Polyfills, as of now, will officially support PHPUnit 12.x (with the exception of the TestListeners), the GH Actions workflow should be updated to reflect this.

This commit:
* Allows for PHPUnit 12 in the `composer.json` `require`.
* Add builds for PHP 8.3 and 8.4 against low PHPUnit 12 versions for the Composer based tests.
    The "high" versions are automatically sorted via the matrix `auto` setting in combination with the Composer PHPUnit version requirements being widened.
* Add builds for PHP 8.3 and 8.4 against high/low PHPUnit 12 for the PHAR based tests.
* Add an extra experimental build in both test workflows against PHP "nightly" to ensure both PHPUnit 9.x, 11.x, as well as PHPUnit 12.x are tested with PHP 8.5.

Refs:
* https://phpunit.de/announcements/phpunit-12.html
* https://github.com/sebastianbergmann/phpunit/blob/12.0/ChangeLog-12.0.md
  • Loading branch information
jrfnl committed Feb 7, 2025
1 parent 891f4f0 commit 8d05e4e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
36 changes: 33 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,35 @@ jobs:
phpunit: '11.0.0'
coverage: true
experimental: false
- php: '8.3'
phpunit: '12.0.0'
coverage: true
experimental: false
- php: '8.4'
phpunit: '11.3.6'
coverage: true
experimental: false
- php: '8.4'
phpunit: '12.0.0'
coverage: true
experimental: false

# Experimental builds.
- php: 'nightly'
phpunit: '^9.6'
coverage: false
experimental: true
- php: 'nightly'
phpunit: 'auto' # PHPUnit 11.x.
phpunit: '^11.5'
coverage: false
experimental: true
- php: 'nightly'
phpunit: 'auto' # PHPUnit 12.x.
coverage: false
experimental: true

- php: 'latest'
phpunit: 'dev-main' # PHPUnit 12.x.
phpunit: 'dev-main' # PHPUnit 12.x/13.x.
coverage: false
experimental: true

Expand Down Expand Up @@ -168,6 +180,8 @@ jobs:
run: |
if [ "${{ matrix.phpunit == 'dev-main' }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '12.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
else
Expand Down Expand Up @@ -287,11 +301,25 @@ jobs:
phpunit: '11'
coverage: true

# PHPUnit 12 is fully supported for the officially supported PHP versions.
- php: '8.3'
phpunit: '12.0'
- php: '8.3'
phpunit: '12'
coverage: true
- php: '8.4'
phpunit: '12.0'
- php: '8.4'
phpunit: '12'
coverage: true

# Experimental builds.
- php: 'nightly'
phpunit: '9'
- php: 'nightly'
phpunit: '11'
- php: 'nightly'
phpunit: '12'

name: "PHAR test: PHP ${{ matrix.php }} - PHPUnit: ${{matrix.phpunit}}"

Expand Down Expand Up @@ -348,7 +376,9 @@ jobs:
- name: Determine PHPUnit config
id: phpunit_config
run: |
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '12.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
else
echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"require": {
"php": ">=7.1",
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.0 || ^11.0"
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.0 || ^11.0 || ^12.0"
},
"require-dev": {
"php-parallel-lint/php-console-highlighter": "^1.0.0",
Expand Down Expand Up @@ -90,7 +90,7 @@
"fix-cs": "Auto-fix code style violations in the PHP files.",
"test": "Run the unit tests without code coverage (PHPUnit < 10).",
"coverage": "Run the unit tests with code coverage (PHPUnit < 10).",
"test10": "Run the unit tests without code coverage using the PHPUnit 10/11 configuration file.",
"coverage10": "Run the unit tests with code coverage using the PHPUnit 10/11 configuration file."
"test10": "Run the unit tests without code coverage using the PHPUnit 10/11/12 configuration file.",
"coverage10": "Run the unit tests with code coverage using the PHPUnit 10/11/12 configuration file."
}
}

0 comments on commit 8d05e4e

Please sign in to comment.