Make WordPress Core

Changeset 64104


Ignore:
Timestamp:
10/05/2026 06:34:52 PM (5 weeks ago)
Author:
lancewillett
Message:

Tests: Make theme test data providers static.

Declare 28 data providers in the theme tests as public static for compatibility with newer PHPUnit versions. Preserve all datasets and assertions.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/14003

Props therssoftware, mukesh27.
See #66211.

Location:
trunk/tests/phpunit/tests/theme
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/customHeader.php

    r60729 r64104  
    112112         * @return array
    113113         */
    114         public function data_filter_header_image() {
     114        public static function data_filter_header_image() {
    115115                return array(
    116116                        'an image url'         => array(
  • trunk/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php

    r63627 r64104  
    385385         * @return array[]
    386386         */
    387         public function data_wp_get_block_name_from_theme_json_path() {
     387        public static function data_wp_get_block_name_from_theme_json_path() {
    388388                return array(
    389389                        'core block styles'             => array(
  • trunk/tests/phpunit/tests/theme/wpGetGlobalStylesheet.php

    r57259 r64104  
    8888         * @return array[]
    8989         */
    90         public function data_should_conditionally_include_font_sizes() {
     90        public static function data_should_conditionally_include_font_sizes() {
    9191                return array(
    9292                        'block theme using defaults'                   => array(
    … …  
    186186         * @return array[]
    187187         */
    188         public function data_should_not_conditionally_include_font_sizes() {
     188        public static function data_should_not_conditionally_include_font_sizes() {
    189189                return array(
    190190                        'block theme using presets'                   => array(
  • trunk/tests/phpunit/tests/theme/wpTheme.php

    r63507 r64104  
    526526         * @return array
    527527         */
    528         public function data_is_block_theme() {
     528        public static function data_is_block_theme() {
    529529                return array(
    530530                        'default - non-block theme' => array(
    … …  
    568568         * @return array
    569569         */
    570         public function data_get_file_path() {
     570        public static function data_get_file_path() {
    571571                return array(
    572572                        'no theme: no file given'              => array(
  • trunk/tests/phpunit/tests/theme/wpThemeGetBlockPatterns.php

    r63595 r64104  
    183183         * @return array[]
    184184         */
    185         public function data_get_block_patterns() {
     185        public static function data_get_block_patterns() {
    186186                return array(
    187187                        array(
  • trunk/tests/phpunit/tests/theme/wpThemeHasThemeJson.php

    r55086 r64104  
    3030         * @return array[]
    3131         */
    32         public function data_theme_has_theme_json_reports_correctly() {
     32        public static function data_theme_has_theme_json_reports_correctly() {
    3333                return array(
    3434                        'a theme with theme.json'       => array(
  • trunk/tests/phpunit/tests/theme/wpThemeJson.php

    r63934 r64104  
    51425142         * @return array
    51435143         */
    5144         public function data_get_property_value_should_return_string_for_invalid_paths_or_null_values() {
     5144        public static function data_get_property_value_should_return_string_for_invalid_paths_or_null_values() {
    51455145                return array(
    51465146                        'empty string' => array(
    … …  
    55955595         * @return array
    55965596         */
    5597         public function data_sanitize_for_block_with_style_variations() {
     5597        public static function data_sanitize_for_block_with_style_variations() {
    55985598                return array(
    55995599                        '1 variation with 1 valid property'     => array(
    … …  
    58155815         * @return array
    58165816         */
    5817         public function data_sanitize_with_invalid_style_variation() {
     5817        public static function data_sanitize_with_invalid_style_variation() {
    58185818                return array(
    58195819                        'empty string variation' => array(
    … …  
    58675867         * @return array
    58685868         */
    5869         public function data_get_styles_for_block_with_style_variations() {
     5869        public static function data_get_styles_for_block_with_style_variations() {
    58705870                $plain = array(
    58715871                        'metadata' => array(
    … …  
    63396339         * @return array
    63406340         */
    6341         public function data_set_spacing_sizes() {
     6341        public static function data_set_spacing_sizes() {
    63426342                return array(
    63436343                        'only one value when single step in spacing scale' => array(
    … …  
    66306630         * @return array
    66316631         */
    6632         public function data_set_spacing_sizes_when_invalid() {
     6632        public static function data_set_spacing_sizes_when_invalid() {
    66336633                return array(
    66346634                        'missing operator value'  => array(
    … …  
    67236723         * @return array
    67246724         */
    6725         public function data_update_separator_declarations() {
     6725        public static function data_update_separator_declarations() {
    67266726                return array(
    67276727                        // If only background is defined, test that includes border-color to the style so it is applied on the front end.
    … …  
    68236823         * @return array
    68246824         */
    6825         public function data_update_button_width_declarations() {
     6825        public static function data_update_button_width_declarations() {
    68266826                return array(
    68276827                        'direct percentage value'                   => array(
    … …  
    73067306         * @return array[]
    73077307         */
    7308         public function data_custom_css_for_user_caps() {
     7308        public static function data_custom_css_for_user_caps() {
    73097309                return array(
    73107310                        'allows custom css for users with caps'     => array(
    … …  
    73717371         * @return array[]
    73727372         */
    7373         public function data_process_blocks_custom_css() {
     7373        public static function data_process_blocks_custom_css() {
    73747374                return array(
    73757375                        // Simple CSS without any nested selectors.
    … …  
    77107710         * @return array[]
    77117711         */
    7712         public function data_get_block_style_variation_selector() {
     7712        public static function data_get_block_style_variation_selector() {
    77137713                return array(
    77147714                        'empty block selector'     => array(
    … …  
    89998999         * @return array<string, {selector: string, to_append: string, expeted: string}>
    90009000         */
    9001         public function data_append_to_selector() {
     9001        public static function data_append_to_selector() {
    90029002                return array(
    90039003                        'single class selector'                        => array(
    … …  
    91399139         * @return array<string, {selector: string, to_prepend: string, expeted: string}>
    91409140         */
    9141         public function data_prepend_to_selector() {
     9141        public static function data_prepend_to_selector() {
    91429142                return array(
    91439143                        'single class selector'                        => array(
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r63948 r64104  
    325325         * @return array
    326326         */
    327         public function data_has_same_registered_blocks_when_all_blocks_not_cached() {
     327        public static function data_has_same_registered_blocks_when_all_blocks_not_cached() {
    328328                return array(
    329329                        'origin: core; cache: empty'       => array(
    … …  
    400400         * @return array
    401401         */
    402         public function data_has_same_registered_blocks_when_all_blocks_are_cached() {
     402        public static function data_has_same_registered_blocks_when_all_blocks_are_cached() {
    403403                return array(
    404404                        'core'   => array( 'core' ),
    … …  
    445445         * @return array
    446446         */
    447         public function data_get_core_data() {
     447        public static function data_get_core_data() {
    448448                return array(
    449449                        'When both caches are empty'     => array(
    … …  
    978978         * @return array[]
    979979         */
    980         public function data_get_merged_data_returns_origin() {
     980        public static function data_get_merged_data_returns_origin() {
    981981                return array(
    982982                        'origin_default' => array(
    … …  
    10621062         * @return array
    10631063         */
    1064         public function data_get_style_variations() {
     1064        public static function data_get_style_variations() {
    10651065                return array(
    10661066                        // @ticket 57545
  • trunk/tests/phpunit/tests/theme/wpThemeJsonSelectorList.php

    r63527 r64104  
    4646         * @return array<string, array{selector: string, expected: string[]}>
    4747         */
    48         public function data_split_selector_list() {
     48        public static function data_split_selector_list() {
    4949                return array(
    5050                        'single selector'                       => array(
    … …  
    115115         * @return array<string, array{selector: string, expected: string}>
    116116         */
    117         public function data_prepend_to_selector_uses_safe_splitting() {
     117        public static function data_prepend_to_selector_uses_safe_splitting() {
    118118                return array(
    119119                        'fast path for simple selector list' => array(
Note: See TracChangeset for help on using the changeset viewer.