[wp-trac] [WordPress Trac] #46149: PHPUnit 8.x support
WordPress Trac
noreply at wordpress.org
Tue Aug 10 21:13:53 UTC 2021
#46149: PHPUnit 8.x support
-------------------------------------------------+-------------------------
Reporter: SergeyBiryukov | Owner: jrf
Type: task (blessed) | Status: assigned
Priority: high | Milestone: 5.9
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests early php8 | Focuses:
needs-dev-note commit |
-------------------------------------------------+-------------------------
Comment (by SergeyBiryukov):
In [changeset:"51598" 51598]:
{{{
#!CommitTicketReference repository="" revision="51598"
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.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46149#comment:110>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list