Make WordPress Core

Changeset 64744


Ignore:
Timestamp:
10/26/2026 09:25:36 PM (10 hours ago)
Author:
lancewillett
Message:

Tests: Make URL, routing, hook and shortcode data providers static.

Declare 20 data providers in the actions, admin bar, canonical, filters, rewrite, shortcode and URL tests as public static for compatibility with newer PHPUnit versions. Preserve their datasets and assertions.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/14706, ​https://github.com/WordPress/wordpress-develop/pull/14723, ​https://github.com/WordPress/wordpress-develop/pull/14724, ​https://github.com/WordPress/wordpress-develop/pull/14790, ​https://github.com/WordPress/wordpress-develop/pull/14792, ​https://github.com/WordPress/wordpress-develop/pull/14793, ​https://github.com/WordPress/wordpress-develop/pull/14803

Props devmuhib, shailu25, mukesh27, huzaifaalmesbah.
See #66211.

Location:
trunk/tests/phpunit/tests
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/actions.php

    r64436 r64744  
    287287         * @return array[]
    288288         */
    289         public function data_priority_callback_order_with_integers() {
     289        public static function data_priority_callback_order_with_integers() {
    290290                return array(
    291291                        'int DESC' => array(
    … …  
    305305         * @return array[]
    306306         */
    307         public function data_priority_callback_order_with_unhappy_path_nonintegers() {
     307        public static function data_priority_callback_order_with_unhappy_path_nonintegers() {
    308308                return array(
    309309                        // Numbers as strings and floats.
  • trunk/tests/phpunit/tests/adminbar.php

    r64583 r64744  
    277277         * }
    278278         */
    279         public function data_admin_bar_nodes_with_tabindex_meta() {
     279        public static function data_admin_bar_nodes_with_tabindex_meta() {
    280280                return array(
    281281                        array(
    … …  
    805805         * }
    806806         */
    807         public function data_my_sites_network_menu_items() {
     807        public static function data_my_sites_network_menu_items() {
    808808                return array(
    809809                        array( 'my-sites-super-admin', 'manage_network' ),
  • trunk/tests/phpunit/tests/canonical.php

    r64300 r64744  
    6969        }
    7070
    71         public function data_canonical() {
     71        public static function data_canonical() {
    7272                /*
    7373                 * Data format:
    … …  
    346346         * }
    347347         */
    348         public function data_redirect_guess_404_permalink_with_custom_statuses() {
     348        public static function data_redirect_guess_404_permalink_with_custom_statuses() {
    349349                return array(
    350350                        'public status'                      => array(
    … …  
    396396         * @return array[]
    397397         */
    398         public function data_redirect_guess_404_permalink_post_types() {
     398        public static function data_redirect_guess_404_permalink_post_types() {
    399399                return array(
    400400                        'single string formatted post type'    => array(
    … …  
    674674         * @return array[]
    675675         */
    676         public function data_canonical_attachment_page_redirect_with_option_disabled() {
     676        public static function data_canonical_attachment_page_redirect_with_option_disabled() {
    677677                return array(
    678678                        'logged out user, no parent'      => array(
  • trunk/tests/phpunit/tests/filters.php

    r63616 r64744  
    182182         * @return array[]
    183183         */
    184         public function data_priority_callback_order_with_integers() {
     184        public static function data_priority_callback_order_with_integers() {
    185185                return array(
    186186                        'int DESC' => array(
    … …  
    200200         * @return array[]
    201201         */
    202         public function data_priority_callback_order_with_unhappy_path_nonintegers() {
     202        public static function data_priority_callback_order_with_unhappy_path_nonintegers() {
    203203                return array(
    204204                        // Numbers as strings and floats.
  • trunk/tests/phpunit/tests/rewrite.php

    r63594 r64744  
    295295         * @return array[]
    296296         */
    297         public function data_url_to_postid_host_matching() {
     297        public static function data_url_to_postid_host_matching() {
    298298                return array(
    299299                        'the site host'              => array( 'example.com', true ),
  • trunk/tests/phpunit/tests/shortcode.php

    r63628 r64744  
    429429        }
    430430
    431         public function data_strip_shortcodes() {
     431        public static function data_strip_shortcodes() {
    432432                return array(
    433433                        array( 'before', 'before[gallery]' ),
    … …  
    548548        }
    549549
    550         public function data_escaping() {
     550        public static function data_escaping() {
    551551                return array(
    552552                        array(
    … …  
    626626        }
    627627
    628         public function data_escaping2() {
     628        public static function data_escaping2() {
    629629                return array(
    630630                        array(
    … …  
    701701        }
    702702
    703         public function data_registration_bad() {
     703        public static function data_registration_bad() {
    704704                return array(
    705705                        array(
    … …  
    734734        }
    735735
    736         public function data_registration_good() {
     736        public static function data_registration_good() {
    737737                return array(
    738738                        array(
    … …  
    762762        }
    763763
    764         public function data_whole_posts() {
     764        public static function data_whole_posts() {
    765765                require_once DIR_TESTDATA . '/formatting/whole-posts.php';
    766766                return data_whole_posts();
  • trunk/tests/phpunit/tests/url.php

    r63633 r64744  
    3636        }
    3737
    38         public function data_is_ssl() {
     38        public static function data_is_ssl() {
    3939                return array(
    4040                        array(
    … …  
    103103        }
    104104
    105         public function data_admin_urls() {
     105        public static function data_admin_urls() {
    106106                return array(
    107107                        array(
    … …  
    173173        }
    174174
    175         public function data_home_urls() {
     175        public static function data_home_urls() {
    176176                return array(
    177177                        array(
Note: See TracChangeset for help on using the changeset viewer.