From 76ab1b8891b05fe2f95573b69d21100d9dc3cded Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 2 Dec 2023 11:56:31 +0000 Subject: [PATCH] Build/Test Tools: Allow overriding the `WP_UnitTestCase_Base::factory()` method. This allows third-party plugins to write their own factory extending `WP_UnitTest_Factory` for testing purposes, as well as benefit from `WP_UnitTestCase_Base` features. Follow-up to [35186], [35225], [35242]. Props hugod. Fixes #59999. git-svn-id: https://develop.svn.wordpress.org/trunk@57149 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/abstract-testcase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index 3f5519ae41..3600722f44 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -72,7 +72,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { $class = 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(); @@ -102,7 +102,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase { 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();