diff --git a/config/patches/core-phpunit/includes/abstract-testcase.php.patch b/config/patches/core-phpunit/includes/abstract-testcase.php.patch index 8d808b4bc..8ea69b774 100644 --- a/config/patches/core-phpunit/includes/abstract-testcase.php.patch +++ b/config/patches/core-phpunit/includes/abstract-testcase.php.patch @@ -1,16 +1,17 @@ diff --git a/includes/core-phpunit/includes/abstract-testcase.php b/includes/core-phpunit/includes/abstract-testcase.php -index 38f846e5..8b627a4c 100644 +index 3600722f..67c4d71c 100644 --- a/includes/core-phpunit/includes/abstract-testcase.php +++ b/includes/core-phpunit/includes/abstract-testcase.php -@@ -19,6 +19,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { - protected $caught_deprecated = array(); +@@ -20,6 +20,8 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { protected $expected_doing_it_wrong = array(); protected $caught_doing_it_wrong = array(); -+ private static ?string $calledClass = null; ++ private static ?string $calledClass = null; ++ protected static $hooks_saved = array(); protected static $ignore_files; -@@ -37,7 +38,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { + +@@ -37,7 +39,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { * * @return WP_UnitTest_Factory The fixture factory. */ @@ -19,7 +20,7 @@ index 38f846e5..8b627a4c 100644 static $factory = null; if ( ! $factory ) { $factory = new WP_UnitTest_Factory(); -@@ -53,7 +54,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { +@@ -53,7 +55,7 @@ protected static function factory() { * @return string The class name. */ public static function get_called_class() { @@ -28,7 +29,7 @@ index 38f846e5..8b627a4c 100644 } /** -@@ -69,7 +70,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { +@@ -69,7 +71,7 @@ public static function set_up_before_class() { $wpdb->db_connect(); ini_set( 'display_errors', 1 ); @@ -36,17 +37,17 @@ index 38f846e5..8b627a4c 100644 + $class = self::$calledClass ?? get_called_class(); if ( method_exists( $class, 'wpSetUpBeforeClass' ) ) { - call_user_func( array( $class, 'wpSetUpBeforeClass' ), self::factory() ); -@@ -82,7 +83,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { + call_user_func( array( $class, 'wpSetUpBeforeClass' ), static::factory() ); +@@ -82,7 +84,7 @@ public static function set_up_before_class() { * Runs the routine after all tests have been run. */ public static function tear_down_after_class() { - $class = get_called_class(); -+ $class = self::$calledClass ?? get_called_class(); ++ $class = self::$calledClass ?? get_called_class(); if ( method_exists( $class, 'wpTearDownAfterClass' ) ) { call_user_func( array( $class, 'wpTearDownAfterClass' ) ); -@@ -623,7 +624,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { +@@ -646,7 +648,7 @@ public function expectedDeprecated() { * * @since 4.2.0 */ @@ -55,7 +56,7 @@ index 38f846e5..8b627a4c 100644 $this->expectedDeprecated(); } -@@ -1604,4 +1605,9 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { +@@ -1655,4 +1657,9 @@ public static function touch( $file ) { touch( $file ); } diff --git a/includes/core-phpunit/includes/abstract-testcase.php b/includes/core-phpunit/includes/abstract-testcase.php index 0cfd261ca..67c4d71ce 100644 --- a/includes/core-phpunit/includes/abstract-testcase.php +++ b/includes/core-phpunit/includes/abstract-testcase.php @@ -19,7 +19,8 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { protected $caught_deprecated = array(); protected $expected_doing_it_wrong = array(); protected $caught_doing_it_wrong = array(); - private static ?string $calledClass = null; + + private static ?string $calledClass = null; protected static $hooks_saved = array(); protected static $ignore_files; @@ -73,7 +74,7 @@ public static function set_up_before_class() { $class = self::$calledClass ?? get_called_class(); if ( method_exists( $class, 'wpSetUpBeforeClass' ) ) { - call_user_func( array( $class, 'wpSetUpBeforeClass' ), self::factory() ); + call_user_func( array( $class, 'wpSetUpBeforeClass' ), static::factory() ); } self::commit_transaction(); @@ -83,7 +84,7 @@ public static function set_up_before_class() { * Runs the routine after all tests have been run. */ public static function tear_down_after_class() { - $class = self::$calledClass ?? get_called_class(); + $class = self::$calledClass ?? get_called_class(); if ( method_exists( $class, 'wpTearDownAfterClass' ) ) { call_user_func( array( $class, 'wpTearDownAfterClass' ) ); @@ -103,7 +104,7 @@ public static function tear_down_after_class() { public function set_up() { set_time_limit( 0 ); - $this->factory = self::factory(); + $this->factory = static::factory(); if ( ! self::$ignore_files ) { self::$ignore_files = $this->scan_user_uploads();