File tree 2 files changed +9
-9
lines changed
2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 21
21
$ test_root = '../../../../../../../tests/phpunit ' ;
22
22
}
23
23
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
-
29
24
if ( file_exists ( $ test_root . '/includes/functions.php ' ) ) {
30
25
require_once $ test_root . '/includes/functions.php ' ;
31
26
function _manually_load_plugin () {
@@ -35,4 +30,12 @@ function _manually_load_plugin() {
35
30
tests_add_filter ( 'muplugins_loaded ' , '_manually_load_plugin ' );
36
31
}
37
32
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
+
38
41
require $ test_root . '/includes/bootstrap.php ' ;
Original file line number Diff line number Diff line change 1
1
<?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 ' , '>= ' ) ) {
6
3
class_alias ( 'PHPUnit\Framework\TestCase ' , 'PHPUnit_Framework_TestCase ' );
7
4
class_alias ( 'PHPUnit\Framework\Exception ' , 'PHPUnit_Framework_Exception ' );
8
5
class_alias ( 'PHPUnit\Framework\ExpectationFailedException ' , 'PHPUnit_Framework_ExpectationFailedException ' );
You can’t perform that action at this time.
0 commit comments