Make WordPress Core

Changeset 50982


Ignore:
Timestamp:
05/24/2021 09:03:15 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/functions.php

    r50929 r50982  
    88 */
    99function tests_get_phpunit_version() {
    10     if ( class_exists( 'PHPUnit_Runner_Version' ) ) {
     10    if ( class_exists( 'PHPUnit\Runner\Version' ) ) {
     11        $version = PHPUnit\Runner\Version::id();
     12    } elseif ( class_exists( 'PHPUnit_Runner_Version' ) ) {
    1113        $version = PHPUnit_Runner_Version::id();
    12     } elseif ( class_exists( 'PHPUnit\Runner\Version' ) ) {
    13         $version = PHPUnit\Runner\Version::id();
    1414    } else {
    1515        $version = 0;
Note: See TracChangeset for help on using the changeset viewer.