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.
As can be seen in the build against
nightly
on the latestmaster
, the unit tests fail to run on PHP 8 at this moment, which makes ensuring compatibility with the upcoming PHP 8.0 release hard.This PR updates the PHPUnit setup to allow the tests to be compatible with a wider range of PHPUnit versions, which will then allow them to run on PHP 8.0, even though they would still use an unsupported PHPUnit version (official PHPUnit support for PHP 8 is expected in the upcoming 9.3 release).
It also sets up the unit tests to actually fail the build if they don't pass and implements some stricter testing.
If you examine the build logs on Travis for this PR, you will see that the tests will now actually run against PHP
nightly
and pass.Commit Details
PHPUnit setup: rename and update the config file
It is recommended to use the
phpunit.xml.dist
file name for the PHPUnit configuration file to allow individual developers to overload it with aphpunit.xml
file.To this end, I've:
export-ignore
in.gitattributes
.phpunit.xml
to the.gitignore
file so overload files from individual developers do not get committed.build.xml
file.As for the config file itself:
filter
directive to be more precise.backupGlobals
setting as the default value has changed across PHPUnit versions.PHPUnit: use a type-safe assertion
assertEquals()
is toassertSame()
as==
is to===
, so always useassertSame()
unless you need a loose comparison.PHPUnit: widen the version requirements
Made the unit tests compatible with PHPUnit 4.x - 7.x.
Travis: allow for installing PHPUnit 7 on PHP 8
Ant: fail the build on unit test failures