mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Build/Test Tools: Make WP_TESTS_PHPUNIT_POLYFILLS_PATH more flexible.
The constant `WP_TESTS_PHPUNIT_POLYFILLS_PATH` is intended to contain the path to the root directory of the PHPUnit Polyfills library without trailing slash. The code already took into account that the value could potentially include a trailing slash. Now it will also take into account if it is accidentally set to point to the autoload file instead of the path. Follow-up to [51598]. Props jrf, schlessera, hellofromTonya, jeherve, lucatume. See #46149. git-svn-id: https://develop.svn.wordpress.org/trunk@51810 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -86,8 +86,13 @@ if ( ! class_exists( 'Yoast\PHPUnitPolyfills\Autoload' ) ) {
|
||||
if ( is_string( WP_TESTS_PHPUNIT_POLYFILLS_PATH )
|
||||
&& '' !== WP_TESTS_PHPUNIT_POLYFILLS_PATH
|
||||
) {
|
||||
$phpunit_polyfills_path = rtrim( $phpunit_polyfills_path, '/\\' );
|
||||
$phpunit_polyfills_path = realpath( $phpunit_polyfills_path . '/phpunitpolyfills-autoload.php' );
|
||||
// Be tolerant to the path being provided including the filename.
|
||||
if ( substr( $phpunit_polyfills_path, -29 ) !== 'phpunitpolyfills-autoload.php' ) {
|
||||
$phpunit_polyfills_path = rtrim( $phpunit_polyfills_path, '/\\' );
|
||||
$phpunit_polyfills_path = $phpunit_polyfills_path . '/phpunitpolyfills-autoload.php';
|
||||
}
|
||||
|
||||
$phpunit_polyfills_path = realpath( $phpunit_polyfills_path );
|
||||
if ( false !== $phpunit_polyfills_path ) {
|
||||
$phpunit_polyfills_autoloader = $phpunit_polyfills_path;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user