WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 months ago)
Author:
hellofromTonya
Message:

Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a public visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a private visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a _ prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/nav-menus.php

    r51569 r52010  
    2020     * @see WP_UnitTestCase::setup()
    2121     */
    22     function set_up() {
     22    public function set_up() {
    2323        parent::set_up();
    2424        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
     
    3232     * Delete the $wp_customize global when cleaning up scope.
    3333     */
    34     function clean_up_global_scope() {
     34    public function clean_up_global_scope() {
    3535        global $wp_customize;
    3636        $wp_customize = null;
     
    4444     * @return array Menu item types.
    4545     */
    46     function filter_item_types( $items ) {
     46    public function filter_item_types( $items ) {
    4747        $items[] = array(
    4848            'title'      => 'Custom',
     
    6363     * @return array Menu items.
    6464     */
    65     function filter_items( $items, $type, $object ) {
     65    public function filter_items( $items, $type, $object ) {
    6666        $items[] = array(
    6767            'id'         => 'custom-1',
     
    8282     * @see WP_Customize_Nav_Menus::__construct()
    8383     */
    84     function test_construct() {
     84    public function test_construct() {
    8585        do_action( 'customize_register', $this->wp_customize );
    8686        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    108108     * @see WP_Customize_Nav_Menus::load_available_items_query()
    109109     */
    110     function test_load_available_items_query_returns_wp_error() {
     110    public function test_load_available_items_query_returns_wp_error() {
    111111        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    112112
     
    127127     * @see WP_Customize_Nav_Menus::load_available_items_query()
    128128     */
    129     function test_load_available_items_query_maybe_returns_home() {
     129    public function test_load_available_items_query_maybe_returns_home() {
    130130        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    131131
     
    158158     * @see WP_Customize_Nav_Menus::load_available_items_query()
    159159     */
    160     function test_load_available_items_query_returns_post_item_with_page_number() {
     160    public function test_load_available_items_query_returns_post_item_with_page_number() {
    161161        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    162162
     
    188188     * @see WP_Customize_Nav_Menus::load_available_items_query()
    189189     */
    190     function test_load_available_items_query_returns_page_item() {
     190    public function test_load_available_items_query_returns_page_item() {
    191191        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    192192
     
    219219     * @see WP_Customize_Nav_Menus::load_available_items_query()
    220220     */
    221     function test_load_available_items_query_returns_post_item() {
     221    public function test_load_available_items_query_returns_post_item() {
    222222        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    223223
     
    245245     * @see WP_Customize_Nav_Menus::load_available_items_query()
    246246     */
    247     function test_load_available_items_query_returns_term_item() {
     247    public function test_load_available_items_query_returns_term_item() {
    248248        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    249249
     
    271271     * @see WP_Customize_Nav_Menus::load_available_items_query()
    272272     */
    273     function test_load_available_items_query_returns_custom_item() {
     273    public function test_load_available_items_query_returns_custom_item() {
    274274        add_filter( 'customize_nav_menu_available_item_types', array( $this, 'filter_item_types' ) );
    275275        add_filter( 'customize_nav_menu_available_items', array( $this, 'filter_items' ), 10, 4 );
     
    296296     * @see WP_Customize_Nav_Menus::search_available_items_query()
    297297     */
    298     function test_search_available_items_query() {
     298    public function test_search_available_items_query() {
    299299        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    300300        do_action( 'customize_register', $this->wp_customize );
     
    465465     * @return array Items.
    466466     */
    467     function filter_search( $items, $args ) {
     467    public function filter_search( $items, $args ) {
    468468        $this->assertIsArray( $items );
    469469        $this->assertIsArray( $args );
     
    493493     * @see WP_Customize_Nav_Menus::enqueue_scripts()
    494494     */
    495     function test_enqueue_scripts() {
     495    public function test_enqueue_scripts() {
    496496        do_action( 'customize_register', $this->wp_customize );
    497497        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    508508     * @see WP_Customize_Nav_Menus::filter_dynamic_setting_args()
    509509     */
    510     function test_filter_dynamic_setting_args() {
     510    public function test_filter_dynamic_setting_args() {
    511511        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    512512
     
    525525     * @see WP_Customize_Nav_Menus::filter_dynamic_setting_class()
    526526     */
    527     function test_filter_dynamic_setting_class() {
     527    public function test_filter_dynamic_setting_class() {
    528528        do_action( 'customize_register', $this->wp_customize );
    529529        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    543543     * @see WP_Customize_Nav_Menus::customize_register()
    544544     */
    545     function test_customize_register() {
     545    public function test_customize_register() {
    546546        do_action( 'customize_register', $this->wp_customize );
    547547        $menu_id = wp_create_nav_menu( 'Primary' );
     
    575575     * @see WP_Customize_Nav_Menus::intval_base10()
    576576     */
    577     function test_intval_base10() {
     577    public function test_intval_base10() {
    578578
    579579        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    594594     * @see WP_Customize_Nav_Menus::available_item_types()
    595595     */
    596     function test_available_item_types() {
     596    public function test_available_item_types() {
    597597
    598598        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    730730     * @see WP_Customize_Nav_Menus::print_templates()
    731731     */
    732     function test_print_templates() {
     732    public function test_print_templates() {
    733733        do_action( 'customize_register', $this->wp_customize );
    734734        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    754754     * @see WP_Customize_Nav_Menus::available_items_template()
    755755     */
    756     function test_available_items_template() {
     756    public function test_available_items_template() {
    757757        add_filter( 'customize_nav_menu_available_item_types', array( $this, 'filter_item_types' ) );
    758758        do_action( 'customize_register', $this->wp_customize );
     
    801801     * @see WP_Customize_Nav_Menus::customize_dynamic_partial_args()
    802802     */
    803     function test_customize_dynamic_partial_args() {
     803    public function test_customize_dynamic_partial_args() {
    804804        do_action( 'customize_register', $this->wp_customize );
    805805
     
    823823     * @see WP_Customize_Nav_Menus::customize_preview_init()
    824824     */
    825     function test_customize_preview_init() {
     825    public function test_customize_preview_init() {
    826826        do_action( 'customize_register', $this->wp_customize );
    827827        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    838838     * @covers WP_Customize_Nav_Menus::make_auto_draft_status_previewable
    839839     */
    840     function test_make_auto_draft_status_previewable() {
     840    public function test_make_auto_draft_status_previewable() {
    841841        global $wp_post_statuses;
    842842        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    850850     * @covers WP_Customize_Nav_Menus::sanitize_nav_menus_created_posts
    851851     */
    852     function test_sanitize_nav_menus_created_posts() {
     852    public function test_sanitize_nav_menus_created_posts() {
    853853        $menus                 = new WP_Customize_Nav_Menus( $this->wp_customize );
    854854        $contributor_user_id   = $this->factory()->user->create( array( 'role' => 'contributor' ) );
     
    924924     * @covers WP_Customize_Nav_Menus::save_nav_menus_created_posts
    925925     */
    926     function test_save_nav_menus_created_posts() {
     926    public function test_save_nav_menus_created_posts() {
    927927        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
    928928        do_action( 'customize_register', $this->wp_customize );
     
    10321032     * @see WP_Customize_Nav_Menus::filter_wp_nav_menu_args()
    10331033     */
    1034     function test_filter_wp_nav_menu_args() {
     1034    public function test_filter_wp_nav_menu_args() {
    10351035        do_action( 'customize_register', $this->wp_customize );
    10361036        $menus   = $this->wp_customize->nav_menus;
     
    11181118     * @covers WP_Customize_Nav_Menus::filter_wp_nav_menu_args
    11191119     */
    1120     function test_filter_wp_nav_menu() {
     1120    public function test_filter_wp_nav_menu() {
    11211121        do_action( 'customize_register', $this->wp_customize );
    11221122        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    11591159     * @see WP_Customize_Nav_Menus::customize_preview_enqueue_deps()
    11601160     */
    1161     function test_customize_preview_enqueue_deps() {
     1161    public function test_customize_preview_enqueue_deps() {
    11621162        do_action( 'customize_register', $this->wp_customize );
    11631163        $menus = new WP_Customize_Nav_Menus( $this->wp_customize );
     
    11731173     * @see WP_Customize_Nav_Menus::export_preview_data()
    11741174     */
    1175     function test_export_preview_data() {
     1175    public function test_export_preview_data() {
    11761176        ob_start();
    11771177        $this->wp_customize->nav_menus->export_preview_data();
     
    11871187     * @see WP_Customize_Nav_Menus::render_nav_menu_partial()
    11881188     */
    1189     function test_render_nav_menu_partial() {
     1189    public function test_render_nav_menu_partial() {
    11901190        $this->wp_customize->nav_menus->customize_preview_init();
    11911191
Note: See TracChangeset for help on using the changeset viewer.