From 00a5f5abf58f3ae6eb0dcf362f711525f4b13ba1 Mon Sep 17 00:00:00 2001 From: Fozle Rabby Date: Fri, 6 Nov 2026 11:29:42 -0400 Subject: [PATCH 1/2] Tests: Make data_provider_default_themes data provider public and static. Declares `data_provider_default_themes()` in `tests/phpunit/tests/theme.php` as `public static` for modern PHPUnit compatibility. Converts `` to a protected static property and updates accesses to `self::`. See #66211. --- tests/phpunit/tests/theme.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php index ac0eebb77a9e5..520e16147ec65 100644 --- a/tests/phpunit/tests/theme.php +++ b/tests/phpunit/tests/theme.php @@ -8,7 +8,7 @@ class Tests_Theme extends WP_UnitTestCase { protected $theme_slug = 'twentyeleven'; protected $theme_name = 'Twenty Eleven'; - protected $default_themes = array( + protected static $default_themes = array( 'twentyten', 'twentyeleven', 'twentytwelve', @@ -236,7 +236,7 @@ public function test_default_theme_in_default_theme_list() { if ( ! $latest_default_theme->exists() ) { $this->fail( 'No default themes are installed.' ); } - $this->assertContains( $latest_default_theme->get_stylesheet(), $this->default_themes ); + $this->assertContains( $latest_default_theme->get_stylesheet(), self::$default_themes ); } /** @@ -261,7 +261,7 @@ public function test_default_default_theme_list_match_in_test_suite_and_at_runti $default_themes = array_keys( $property->getValue() ); $default_themes = array_diff( $default_themes, array( 'default', 'classic' ) ); - $this->assertSameSets( $default_themes, $this->default_themes, 'Test suite default themes should match the runtime default themes.' ); + $this->assertSameSets( $default_themes, self::$default_themes, 'Test suite default themes should match the runtime default themes.' ); } /** @@ -309,7 +309,7 @@ static function ( $file ) { } ); - $tested_themes = $this->default_themes; + $tested_themes = self::$default_themes; // Convert the tested themes to directory names. $tested_themes = array_map( static function ( $theme ) { @@ -322,7 +322,7 @@ static function ( $theme ) { } public function test_default_themes_have_textdomain() { - foreach ( $this->default_themes as $theme ) { + foreach ( self::$default_themes as $theme ) { if ( wp_get_theme( $theme )->exists() ) { $this->assertSame( $theme, wp_get_theme( $theme )->get( 'TextDomain' ) ); } @@ -359,9 +359,9 @@ public function test_year_in_readme( $theme ) { * * @return array */ - public function data_provider_default_themes(): array { + public static function data_provider_default_themes(): array { $data = array(); - foreach ( $this->default_themes as $default_theme ) { + foreach ( self::$default_themes as $default_theme ) { $data[ $default_theme ] = array( 'theme' => $default_theme ); } return $data; From 3aa37cbc8b19e03374593a76da33b5a4448dc42e Mon Sep 17 00:00:00 2001 From: Fozle Rabby Date: Fri, 6 Nov 2026 11:37:12 -0400 Subject: [PATCH 2/2] Tests: Fix property assignment alignment in Tests_Theme for PHPCS. --- tests/phpunit/tests/theme.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php index 520e16147ec65..b1e51bc24fefe 100644 --- a/tests/phpunit/tests/theme.php +++ b/tests/phpunit/tests/theme.php @@ -6,8 +6,8 @@ * @group themes */ class Tests_Theme extends WP_UnitTestCase { - protected $theme_slug = 'twentyeleven'; - protected $theme_name = 'Twenty Eleven'; + protected $theme_slug = 'twentyeleven'; + protected $theme_name = 'Twenty Eleven'; protected static $default_themes = array( 'twentyten', 'twentyeleven',