From 479ea22b8e10db7a2caedf10d860b95886c41b77 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 24 May 2021 21:03:15 +0000 Subject: [PATCH] Tests: Improve PHPUnit version retrieval. Always test for newer class names first and fall back to the older. This improves compatibility when running PHPUnit via a phar while there is also a Composer-installed version of PHPUnit on the system. Props jrf. See #52625. git-svn-id: https://develop.svn.wordpress.org/trunk@50982 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/includes/functions.php b/tests/phpunit/includes/functions.php index 9a6e70414c..7e409d5fce 100644 --- a/tests/phpunit/includes/functions.php +++ b/tests/phpunit/includes/functions.php @@ -7,10 +7,10 @@ require_once __DIR__ . '/class-basic-object.php'; * @return double The version number. */ function tests_get_phpunit_version() { - if ( class_exists( 'PHPUnit_Runner_Version' ) ) { - $version = PHPUnit_Runner_Version::id(); - } elseif ( class_exists( 'PHPUnit\Runner\Version' ) ) { + if ( class_exists( 'PHPUnit\Runner\Version' ) ) { $version = PHPUnit\Runner\Version::id(); + } elseif ( class_exists( 'PHPUnit_Runner_Version' ) ) { + $version = PHPUnit_Runner_Version::id(); } else { $version = 0; }