Skip to content

Commit

Permalink
[TASK] Use PHPUnit 9.x with PHP 7.3+
Browse files Browse the repository at this point in the history
This is required to be able to test against PHP 8.  However, PHPUnit 9.x
requires PHP 7.3, so a different version of PHPUnit is required for different
testing environments.

The main change here is a step in the GitHub Action to conditionally update
PHPUnit via PHIVE for PHP >=7.3.  PHIVE does not yet have the ability for
conditional installs (see
phar-io/phive#295 (comment)) so the
script must check the PHP version before running the update.

PHIVE has also been added to the tools (self-referencing) as it is not available
by default to GitHub Actions.

Note: There are warnings from PHPUnit 9.x about use of deprecated `assert`
methods (which will be removed in PHPUnit 10.x).  However, these don't cause the
tests to fail, and the replacement methods are not available in PHPUnit 7.x
which is still required to test against PHP 7.1 and 7.2.

Part of #925/#926.
  • Loading branch information
JakeQZ committed Nov 21, 2020
1 parent 9e9a1d4 commit 1eb5f29
Show file tree
Hide file tree
Showing 4 changed files with 882 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,11 @@ jobs:
composer update --no-progress "${DEPENDENCIES}";
composer show;
- name: Update PHIVE dependencies
run: |
if ! composer php:version | grep -q '^7\.[012]'; then
composer phive:update:phpunit
fi
- name: Run Tests
run: composer ci:tests:unit
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"ci": [
"@ci:static",
"@ci:dynamic"
]
],
"phive:update:phpunit": "echo y | \"./tools/phive.phar\" update phpunit"
},
"extra": {
"branch-alias": {
Expand Down
3 changes: 2 additions & 1 deletion phive.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phar-io/phive" version="~0.13.5" installed="0.13.5" location="./tools/phive.phar" copy="true"/>
<phar name="php-cs-fixer" version="^2.16" installed="2.16.3" location="./tools/php-cs-fixer.phar" copy="true"/>
<phar name="phpmd" version="^2.8" installed="2.8.2" location="./tools/phpmd.phar" copy="true"/>
<phar name="phpunit" version="^7.5" installed="7.5.20" location="./tools/phpunit.phar" copy="true"/>
<phar name="phpunit" version="^7.5.20 || ^9.4.3" installed="7.5.20" location="./tools/phpunit.phar" copy="true"/>
<phar name="psalm" version="^3.11.5" installed="3.11.5" location="./tools/psalm.phar" copy="true"/>
</phive>
Loading

0 comments on commit 1eb5f29

Please sign in to comment.