Build/Test Tools: Add support for PHPUnit 7.x.

* Create an abstract `WP_UnitTestCase_Base` class to share between PHPUnit 7.x and older versions.
* Add a speed-trap loader to determine which `SpeedTrapListener` class needs to be loaded for the current PHPUnit version.
* Remove unnecessary `PHPUnit\Util\Test` and `PHPUnit_Util_Getopt` inheritances.
* Update Travis CI config to use PHPUnit 7.x for PHP 7.1, 7.2, and nightly PHP versions.

Props jipmoors, netweb, desrosj, ayeshrajans, soulseekah, SergeyBiryukov.
See #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@44701 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2019-01-28 14:10:24 +00:00
parent 639f66aade
commit 001c6498e8
13 changed files with 1556 additions and 1108 deletions

View File

@@ -1,5 +1,21 @@
<?php
/**
* 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;
}
/**
* Resets various `$_SERVER` variables that can get altered during tests.
*/