-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHPUnit: allow for PHPUnit 10 + add separate configuration
The PHPunit configuration file specification has undergone changes in PHPUnit 9.3, 10.0 and 10.1. Most notably: * In PHPUnit 9.3, the manner of specifying the code coverage configuration has changed. * In PHPUnit 10.0, a significant number of attributes of the `<phpunit>` element were removed or renamed. * In PHPUnit 10.1, there is another change related to the code coverage configuration + the ability to fail builds on deprecations/warnings/notices is brought back. While the `--migrate-configuration` command can upgrade a configuration for the changes in the format made in PHPUnit 9.3, some of the changes in the configuration format in PHPUnit 10 don't have one-on-one replacements and/or are not taken into account. As this package is used in the CI pipeline for other packages, it is important for this package to be ready for new PHP releases _early_, so failing the test suite on deprecations/notices and warnings is appropriate. With that in mind, I deem it more appropriate to have a dedicated PHPUnit configuration file for PHPUnit 10 to ensure the test run will behave as intended. This commit adds this dedicated configuration file for PHPUnit 10.1+. Includes: * Ignoring the new file for package archives. * Allowing for a local override file. * Adding scripts to the `composer.json` file to run the tests using this new configuration file and make the use of the separate config make more obvious for contributors. * Updating the GH Actions `test` workflow to trigger the tests on PHPUnit 10 with this configuration file. Ref: * https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-10.0.md#1000---2023-02-03 * sebastianbergmann/phpunit 5196 * sebastianbergmann/phpunit@fb6673f
- Loading branch information
Showing
5 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
/vendor/ | ||
/composer.lock | ||
phpunit.xml | ||
phpunit10.xml | ||
.phpunit.result.cache | ||
.phpcs.xml | ||
phpcs.xml |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/10.1/phpunit.xsd" | ||
backupGlobals="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
bootstrap="./vendor/autoload.php" | ||
colors="true" | ||
displayDetailsOnTestsThatTriggerErrors="true" | ||
displayDetailsOnTestsThatTriggerWarnings="true" | ||
displayDetailsOnTestsThatTriggerNotices="true" | ||
displayDetailsOnTestsThatTriggerDeprecations="true" | ||
displayDetailsOnIncompleteTests="true" | ||
displayDetailsOnSkippedTests="true" | ||
failOnWarning="true" | ||
failOnNotice="true" | ||
failOnDeprecation="true" | ||
requireCoverageMetadata="true" | ||
> | ||
|
||
<testsuites> | ||
<testsuite name="PHP-Console-Highlighter"> | ||
<directory suffix="Test.php">tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<source> | ||
<include> | ||
<directory suffix=".php">./src/</directory> | ||
</include> | ||
</source> | ||
|
||
<coverage includeUncoveredFiles="true" ignoreDeprecatedCodeUnits="true"> | ||
<report> | ||
<clover outputFile="build/logs/clover.xml"/> | ||
<html outputDirectory="build/coverage/"/> | ||
<text outputFile="php://stdout" showOnlySummary="true"/> | ||
</report> | ||
</coverage> | ||
|
||
<php> | ||
<ini name="memory_limit" value="256M"/> | ||
</php> | ||
</phpunit> |