File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 2121 $ test_root = '../../../../../../../tests/phpunit ' ;
2222}
2323
24- // WordPress versions before 4.8 will be incompatible with newer PHPUnit versions.
25- if ( version_compare ( getenv ( 'WP_VERSION ' ), '4.8 ' , '< ' ) && class_exists ( 'PHPUnit\Runner\Version ' ) ) {
26- require_once dirname ( __FILE__ ) . '/phpunit6-compat.php ' ;
27- }
28-
2924if ( file_exists ( $ test_root . '/includes/functions.php ' ) ) {
3025 require_once $ test_root . '/includes/functions.php ' ;
3126 function _manually_load_plugin () {
@@ -35,4 +30,12 @@ function _manually_load_plugin() {
3530 tests_add_filter ( 'muplugins_loaded ' , '_manually_load_plugin ' );
3631}
3732
33+ // Core started including their own phpunit6-compat, so we should use that if we can.
34+ if ( ! file_exists ( $ test_root . '/includes/phpunit6-compat.php ' ) ) {
35+ // WordPress versions before 4.8 will be incompatible with newer PHPUnit versions.
36+ if ( version_compare ( getenv ( 'WP_VERSION ' ), '4.8 ' , '< ' ) && class_exists ( 'PHPUnit\Runner\Version ' ) ) {
37+ require_once dirname ( __FILE__ ) . '/phpunit6-compat.php ' ;
38+ }
39+ }
40+
3841require $ test_root . '/includes/bootstrap.php ' ;
Original file line number Diff line number Diff line change 11<?php
2- if (
3- class_exists ( 'PHPUnit\Runner\Version ' ) &&
4- version_compare ( PHPUnit \Runner \Version::id (), '6.0 ' , '>= ' ) &&
5- ! class_exists ( 'PHPUnit_Framework_TestCase ' ) ) {
2+ if ( class_exists ( 'PHPUnit\Runner\Version ' ) && version_compare ( PHPUnit \Runner \Version::id (), '6.0 ' , '>= ' ) ) {
63 class_alias ( 'PHPUnit\Framework\TestCase ' , 'PHPUnit_Framework_TestCase ' );
74 class_alias ( 'PHPUnit\Framework\Exception ' , 'PHPUnit_Framework_Exception ' );
85 class_alias ( 'PHPUnit\Framework\ExpectationFailedException ' , 'PHPUnit_Framework_ExpectationFailedException ' );
You can’t perform that action at this time.
0 commit comments