Tests: Move loading compatibility layers for PHPUnit 6+ and 7.5+ closer together.

Follow-up to [40536], [44701], [50986].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51333 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-07-06 11:33:27 +00:00
parent 7026369035
commit 67f31935d0

View File

@@ -3,13 +3,6 @@
* Installs WordPress for running the tests and loads WordPress and the test libraries
*/
/**
* Compatibility with PHPUnit 6+
*/
if ( class_exists( 'PHPUnit\Runner\Version' ) ) {
require_once __DIR__ . '/phpunit6/compat.php';
}
if ( defined( 'WP_TESTS_CONFIG_FILE_PATH' ) ) {
$config_file_path = WP_TESTS_CONFIG_FILE_PATH;
} else {
@@ -193,6 +186,12 @@ require_once ABSPATH . '/wp-settings.php';
// Delete any default posts & related data.
_delete_all_posts();
// Load class aliases for compatibility with PHPUnit 6+.
if ( version_compare( tests_get_phpunit_version(), '6.0', '>=' ) ) {
require __DIR__ . '/phpunit6/compat.php';
}
// Load separate WP_UnitTestCase classes for PHPUnit 7.5+ and older versions.
if ( version_compare( tests_get_phpunit_version(), '7.5', '>=' ) ) {
require __DIR__ . '/phpunit7/testcase.php';
} else {