Define the polyfill before attempting to call it
This commit is contained in:
parent
86d44e74bb
commit
5855931542
|
@ -7,6 +7,25 @@
|
|||
|
||||
$wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : '/tmp/wordpress-tests-lib';
|
||||
|
||||
// Polyfill a function that wasn't added until WordPress 5.1.
|
||||
if ( ! function_exists( 'tests_get_phpunit_version' ) ) {
|
||||
/**
|
||||
* Retrieves PHPUnit runner version.
|
||||
*/
|
||||
function tests_get_phpunit_version() {
|
||||
if ( class_exists( 'PHPUnit_Runner_Version' ) ) {
|
||||
$version = PHPUnit_Runner_Version::id();
|
||||
} elseif ( class_exists( 'PHPUnit\Runner\Version' ) ) {
|
||||
// Must be parsable by PHP 5.2.x.
|
||||
$version = call_user_func( 'PHPUnit\Runner\Version::id' );
|
||||
} else {
|
||||
$version = 0;
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The listener-loader.php file wasn't introduced into the core test framework until r44701, which
|
||||
* means it came after WordPress 5.0 (r43971).
|
||||
|
@ -26,22 +45,3 @@ if ( file_exists( $wp_tests_dir . '/includes/listener-loader.php' ) ) {
|
|||
require $wp_tests_dir . '/includes/speed-trap-listener.php';
|
||||
}
|
||||
}
|
||||
|
||||
// Polyfill a function that wasn't added until WordPress 5.1.
|
||||
if ( ! function_exists( 'tests_get_phpunit_version' ) ) {
|
||||
/**
|
||||
* Retrieves PHPUnit runner version.
|
||||
*/
|
||||
function tests_get_phpunit_version() {
|
||||
if ( class_exists( 'PHPUnit_Runner_Version' ) ) {
|
||||
$version = PHPUnit_Runner_Version::id();
|
||||
} elseif ( class_exists( 'PHPUnit\Runner\Version' ) ) {
|
||||
// Must be parsable by PHP 5.2.x.
|
||||
$version = call_user_func( 'PHPUnit\Runner\Version::id' );
|
||||
} else {
|
||||
$version = 0;
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue