Skip to content

Commit 8def694

Browse files
Build/Test Tools: Loosen the PHPUnit restriction.
**composer.json**: Remove the PHPUnit dependency in favor of allowing the PHPUnit Polyfills library to manage the supported PHPUnit version. This automatically now widens the supported PHPUnit versions to 5.7.21 to 9.5.8 (current). Letting the PHPUnit Polyfills handle the version constraints for PHPUnit prevents potential version conflicts in the future, as well as allows WordPress to benefit straight away when a new PHPUnit version would be released and the PHPUnit Polyfills package adds support for that PHPUnit version. **Test Bootstrap** Update the supported version number for PHPUnit 5.x, as the minimum PHPUnit 5.x version supported by the PHPUnit Polyfills is PHPUnit 5.7.21, and remove the PHPUnit maximum. **.gitignore and svn:ignore:** Add the PHPUnit cache file to the list of files to be ignored. Since PHPUnit 8, PHPUnit has a built-in caching feature which creates a `.phpunit.result.cache` file. This file should not be committed. Follow-up to [40536], [40853], [44701], [51559-51573]. Props jrf. See #46149. git-svn-id: https://develop.svn.wordpress.org/trunk@51574 602fd350-edb4-49c9-b593-d223f7449a82
1 parent aae7842 commit 8def694

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ wp-tests-config.php
66
.htaccess
77

88
# Files and folders related to build/test tools
9+
.phpunit.result.cache
910
/phpunit.xml
1011
/.phpcs.xml
1112
/phpcs.xml

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"squizlabs/php_codesniffer": "3.6.0",
1818
"wp-coding-standards/wpcs": "~2.3.0",
1919
"phpcompatibility/phpcompatibility-wp": "~2.1.2",
20-
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5",
2120
"yoast/phpunit-polyfills": "^1.0"
2221
},
2322
"scripts": {

tests/phpunit/includes/bootstrap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737

3838
$phpunit_version = tests_get_phpunit_version();
3939

40-
if ( version_compare( $phpunit_version, '5.7', '<' ) || version_compare( $phpunit_version, '8.0', '>=' ) ) {
40+
if ( version_compare( $phpunit_version, '5.7.21', '<' ) ) {
4141
printf(
42-
"Error: Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.7 and is currently only compatible with PHPUnit up to 7.x.\n",
42+
"Error: Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.7.21.\n",
4343
$phpunit_version
4444
);
45-
echo "Please use the latest PHPUnit version from the 7.x branch.\n";
45+
echo "Please use the latest PHPUnit version supported for the PHP version you are running the tests on.\n";
4646
exit( 1 );
4747
}
4848

0 commit comments

Comments
 (0)