Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 years 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-menu-item-setting.php

    r51568 r52010  
    1919     * @see WP_UnitTestCase::setup()
    2020     */
    21     function set_up() {
     21    public function set_up() {
    2222        parent::set_up();
    2323        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 object
    4545     */
    46     function filter_type_label( $menu_item ) {
     46    public function filter_type_label( $menu_item ) {
    4747        if ( 'custom_type' === $menu_item->type ) {
    4848            $menu_item->type_label = 'Custom Label';
     
    5555     * Test constants and statics.
    5656     */
    57     function test_constants() {
     57    public function test_constants() {
    5858        do_action( 'customize_register', $this->wp_customize );
    5959        $this->assertTrue( post_type_exists( WP_Customize_Nav_Menu_Item_Setting::POST_TYPE ) );
     
    6565     * @see WP_Customize_Nav_Menu_Item_Setting::__construct()
    6666     */
    67     function test_construct() {
     67    public function test_construct() {
    6868        do_action( 'customize_register', $this->wp_customize );
    6969
     
    109109     * Test empty constructor.
    110110     */
    111     function test_construct_empty_menus() {
     111    public function test_construct_empty_menus() {
    112112        do_action( 'customize_register', $this->wp_customize );
    113113        $_wp_customize = $this->wp_customize;
     
    129129     * @see WP_Customize_Nav_Menu_Item_Setting::__construct()
    130130     */
    131     function test_construct_placeholder() {
     131    public function test_construct_placeholder() {
    132132        do_action( 'customize_register', $this->wp_customize );
    133133        $default = array(
     
    147147     * @see WP_Customize_Nav_Menu_Item_Setting::value()
    148148     */
    149     function test_value_type_post_type() {
     149    public function test_value_type_post_type() {
    150150        do_action( 'customize_register', $this->wp_customize );
    151151
     
    198198     * @see WP_Customize_Nav_Menu_Item_Setting::value()
    199199     */
    200     function test_value_type_post_type_without_label() {
     200    public function test_value_type_post_type_without_label() {
    201201        do_action( 'customize_register', $this->wp_customize );
    202202
     
    230230     * @see WP_Customize_Nav_Menu_Item_Setting::value()
    231231     */
    232     function test_value_type_taxonomy() {
     232    public function test_value_type_taxonomy() {
    233233        do_action( 'customize_register', $this->wp_customize );
    234234
     
    269269     * @see WP_Customize_Nav_Menu_Item_Setting::value()
    270270     */
    271     function test_custom_type_label() {
     271    public function test_custom_type_label() {
    272272        do_action( 'customize_register', $this->wp_customize );
    273273        add_filter( 'wp_setup_nav_menu_item', array( $this, 'filter_type_label' ) );
     
    301301     * @see WP_Customize_Nav_Menu_Item_Setting::value()
    302302     */
    303     function test_value_nav_menu_term_id_returns_zero() {
     303    public function test_value_nav_menu_term_id_returns_zero() {
    304304        do_action( 'customize_register', $this->wp_customize );
    305305
     
    346346     * @see WP_Customize_Nav_Menu_Item_Setting::preview()
    347347     */
    348     function test_preview_updated() {
     348    public function test_preview_updated() {
    349349        do_action( 'customize_register', $this->wp_customize );
    350350
     
    401401     * @see WP_Customize_Nav_Menu_Item_Setting::preview()
    402402     */
    403     function test_preview_inserted() {
     403    public function test_preview_inserted() {
    404404        do_action( 'customize_register', $this->wp_customize );
    405405
     
    460460     * @see WP_Customize_Nav_Menu_Item_Setting::preview()
    461461     */
    462     function test_preview_deleted() {
     462    public function test_preview_deleted() {
    463463        do_action( 'customize_register', $this->wp_customize );
    464464
     
    500500     * @see WP_Customize_Nav_Menu_Item_Setting::sanitize()
    501501     */
    502     function test_sanitize() {
     502    public function test_sanitize() {
    503503        do_action( 'customize_register', $this->wp_customize );
    504504
     
    638638     * @see WP_Customize_Nav_Menu_Item_Setting::update()
    639639     */
    640     function test_save_updated() {
     640    public function test_save_updated() {
    641641        do_action( 'customize_register', $this->wp_customize );
    642642
     
    707707     * @see WP_Customize_Nav_Menu_Item_Setting::update()
    708708     */
    709     function test_save_inserted() {
     709    public function test_save_inserted() {
    710710        do_action( 'customize_register', $this->wp_customize );
    711711
     
    780780     * @see WP_Customize_Nav_Menu_Item_Setting::update()
    781781     */
    782     function test_save_deleted() {
     782    public function test_save_deleted() {
    783783        do_action( 'customize_register', $this->wp_customize );
    784784
     
    832832     * @ticket 33665
    833833     */
    834     function test_invalid_nav_menu_item() {
     834    public function test_invalid_nav_menu_item() {
    835835        $menu_id = wp_create_nav_menu( 'Primary' );
    836836        register_post_type(
     
    889889     * @see WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()
    890890     */
    891     function test_value_as_wp_post_nav_menu_item() {
     891    public function test_value_as_wp_post_nav_menu_item() {
    892892        $post_id = self::factory()->post->create();
    893893
     
    950950     * @covers WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item
    951951     */
    952     function test_value_as_wp_post_nav_menu_item_term_urls() {
     952    public function test_value_as_wp_post_nav_menu_item_term_urls() {
    953953        $term_id = self::factory()->term->create( array( 'taxonomy' => 'category' ) );
    954954        register_post_type(
     
    10231023     * @covers WP_Customize_Nav_Menu_Item_Setting::get_original_title
    10241024     */
    1025     function test_get_original_title() {
     1025    public function test_get_original_title() {
    10261026        $menu_id = wp_create_nav_menu( 'Menu' );
    10271027        register_post_type(
     
    12181218     * @see WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()
    12191219     */
    1220     function test_value_as_wp_post_nav_menu_item_with_empty_title() {
     1220    public function test_value_as_wp_post_nav_menu_item_with_empty_title() {
    12211221        $original_title = 'The Original Title';
    12221222        $post_id        = self::factory()->post->create( array( 'post_title' => $original_title ) );
Note: See TracChangeset for help on using the changeset viewer.