diff options
author | Sergey Biryukov <sergeybiryukov@git.wordpress.org> | 2021-08-10 21:13:38 +0000 |
---|---|---|
committer | Sergey Biryukov <sergeybiryukov@git.wordpress.org> | 2021-08-10 21:13:38 +0000 |
commit | 9b565f7907ca1d4cb32eccc980de98683758df17 (patch) | |
tree | 2b10b41beebcde11d63a324758cc949dc86f85f7 /composer.json | |
parent | 43b55b450972af58a10f1c1c0b1bdab51d467f67 (diff) | |
download | wordpress-9b565f7907ca1d4cb32eccc980de98683758df17.tar.gz wordpress-9b565f7907ca1d4cb32eccc980de98683758df17.zip |
Build/Test Tools: Make the polyfills loading more flexible.
The PHPUnit Polyfills are, since [51559], a required dependency for the WP test suite and, by extension, for plugin/theme integration test suites which are based on and use (parts of) the WP core test suite.
However, plugin/theme integration test suites may not use a full WordPress installation.
This commit:
* Removes the presumption that a full WP install, including `vendor` directory, will be available when the test `bootstrap.php` file is run.
* Makes the loading of the PHPUnit Polyfills autoload file more flexible by:
* Checking if the autoload class contained within the autoload file is already available before attempting to load the file.[[BR]]
This allows for plugin/theme integration test suites to load the `phpunitpolyfills-autoload.php` file from any location, as long as it is loaded before the WP core test `bootstrap.php` file is run.
* Allowing for the path to an arbitrary installation location for the PHPUnit Polyfills to be passed as a constant.[[BR]]
As long as the provided location is a valid file path and the `phpunitpolyfills-autoload.php` file exists in the provided location, that file will be loaded.[[BR]]
The constant can be declared in a plugin/theme integration test suite native test bootstrap file, or in the `wp-tests-config.php` file, or even in a `phpunit.xml[.dist]` file via `<php><const name="WP_TESTS_PHPUNIT_POLYFILLS_PATH" value="path/to/yoast/phpunit-polyfills"/></php>`.
* Adds a version check for the PHPUnit Polyfills to prevent a mismatch between the version of the package expected by WordPress and the version used by plugins/themes.[[BR]]
The version this checks for should be in line with the minimum version requirement for the PHPUnit Polyfills as declared in the `composer.json` file.[[BR]]
This version number should only be updated when new features added in later PHPUnit Polyfills releases are actually used in the WP core test suite.
* Adds appropriate error messages for every possible error condition.
* Upgrades the PHPUnit Polyfills to version 1.0.1, which now includes a version constant.
Follow-up to [51559-51577].
Props jrf, hellofromTonya, swissspidy, jeherve, thomasplevy, SergeyBiryukov.
See #46149.
git-svn-id: https://develop.svn.wordpress.org/trunk@51598 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'composer.json')
-rw-r--r-- | composer.json | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/composer.json b/composer.json index 9da1af9769..7910a75687 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "squizlabs/php_codesniffer": "3.6.0", "wp-coding-standards/wpcs": "~2.3.0", "phpcompatibility/phpcompatibility-wp": "~2.1.2", - "yoast/phpunit-polyfills": "^1.0" + "yoast/phpunit-polyfills": "^1.0.1" }, "scripts": { "compat": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=phpcompat.xml.dist --report=summary,source", |