-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible to run tests in PHP 8 #1760
Merged
Merged
+658
−649
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psrpinto
changed the title
Make it possible to run tests when using PHP 8
Make it possible to run tests in PHP 8
Jan 10, 2024
psrpinto
force-pushed
the
tests-php8
branch
5 times, most recently
from
January 10, 2024 15:54
b01a8e4
to
ad3385b
Compare
See 'Return Type of Template Methods' at https://phpunit.de/announcements/phpunit-8.html
This is ready for review. All checks in the PR are passing, |
amieiro
previously approved these changes
Jan 11, 2024
akirk
approved these changes
Jan 11, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
amieiro
approved these changes
Jan 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
It was not possible to run tests under PHP 8 because PHPUnit's version that we were using (
^7
) does not support PHP 8. The earliest PHPUnit version that supports PHP 8 is9.3
.Solution
Upgrade PHPUnit to
^9.6
(9.6 is the latest minor version of PHPUnit 9).Changes to GitHub actions
GitHub actions have been modified to run tests for multisite on and multisite off, on latest and nightly, and on both 7.4 and 8.3. Coverage runs only on 8.3.
Helper scripts for running tests in wp-env
Two new npm scripts have been added to facilitate running tests in the wp-env's
tests-cli
container:npm run env:tests
: Runs composer install and then runs testsnpm run env:tests-cmd
: Facilitates running arbitrary commands in the tests container, e.g. run a single test:npm run env:tests-cmd vendor/bin/phpunit -- --filter test_multiple_imports_singular
To-do
^8
. PHPUnit 8's release notes.^8
^8
^9
. PHPUnit 9's release notes.^9
Testing Instructions
npm run env:start
npm run env:tests