Make WordPress Core


Ignore:
Timestamp:
11/01/2022 08:15:25 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Docs: Update comments in wp_nav_menu() tests per the documentation standards.

Includes:

  • Fixing a few typos.
  • Using the correct format for multi-line comments.
  • Removing some comments that duplicate the assertion messages without providing any additional context.

Follow-up to [54478].

See #56792.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/menu/wp-nav-menu.php

    r54478 r54741  
    5454        );
    5555
    56         /**
    57          * This filter is used to prevent reusing a menu item ID more that once. It cause the tests to failed
    58          * after the first one since the IDs are missing from the HTML generated by `wp_nav_menu`.
     56        /*
     57         * This filter is used to prevent reusing a menu item ID more that once.
     58         * It caused the tests to fail after the first one since the IDs are missing
     59         * from the HTML generated by `wp_nav_menu()`.
    5960         *
    60          * To allow the tests to pass, we remove the filter before running them and add it back after
    61          * they ran ({@see Tests_Menu_wpNavMenu::tear_down_after_class()}).
     61         * To allow the tests to pass, we remove the filter before running them
     62         * and add it back after they ran ({@see Tests_Menu_wpNavMenu::tear_down_after_class()}).
    6263         */
    6364        remove_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once' );
     
    6768        wp_delete_nav_menu( self::$menu_id );
    6869
    69         /**
    70          * This filter was removed to let the tests pass and need to be added back ({@see Tests_Menu_wpNavMenu::set_up_before_class}).
     70        /*
     71         * This filter was removed to let the tests pass and needs to be added back
     72         * ({@see Tests_Menu_wpNavMenu::set_up_before_class}).
    7173         */
    7274        add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 );
     
    7678
    7779    /**
    78      * Test all menu items containing children have the CSS class `menu-item-has-children` when displaying the menu
    79      * without specifying a custom depth.
     80     * Tests that all menu items containing children have the CSS class `menu-item-has-children`
     81     * when displaying the menu without specifying a custom depth.
    8082     *
    8183     * @ticket 28620
     
    9193        );
    9294
    93         // Level 0 should be present in the HTML output and have the `menu-item-has-children` class.
    9495        $this->assertStringContainsString(
    9596            sprintf(
     
    9899            ),
    99100            $menu_html,
    100             'Level 0 should be present in the HTML output and have the menu-item-has-children class'
     101            'Level 0 should be present in the HTML output and have the `menu-item-has-children` class.'
    101102        );
    102103
    103         // Level 1 should be present in the HTML output and have the `menu-item-has-children` class.
    104104        $this->assertStringContainsString(
    105105            sprintf(
     
    108108            ),
    109109            $menu_html,
    110             'Level 1 should be present in the HTML output and have the menu-item-has-children class'
     110            'Level 1 should be present in the HTML output and have the `menu-item-has-children` class.'
    111111        );
    112112
    113         // Level 2 should be present in the HTML output and not have the `menu-item-has-children` class since it has no
    114         // children.
    115113        $this->assertStringContainsString(
    116114            sprintf(
     
    119117            ),
    120118            $menu_html,
    121             'Level 2 should be present in the HTML output and not have the `menu-item-has-children` class since it has no children'
     119            'Level 2 should be present in the HTML output and not have the `menu-item-has-children` class since it has no children.'
    122120        );
    123121    }
     
    140138        );
    141139
    142         // Level 0 should be present in the HTML output and have the `menu-item-has-children` class.
    143140        $this->assertStringContainsString(
    144141            sprintf(
     
    147144            ),
    148145            $menu_html,
    149             'Level 0 should be present in the HTML output and have the menu-item-has-children class'
     146            'Level 0 should be present in the HTML output and have the `menu-item-has-children` class.'
    150147        );
    151148
    152         // Level 1 should be present in the HTML output and not have the `menu-item-has-children` class since its the
    153         // last item to be rendered.
    154149        $this->assertStringContainsString(
    155150            sprintf(
     
    158153            ),
    159154            $menu_html,
    160             'Level 1 should be present in the HTML output and not have the `menu-item-has-children` class since its the last item to be rendered'
     155            'Level 1 should be present in the HTML output and not have the `menu-item-has-children` class since it is the last item to be rendered.'
    161156        );
    162157
    163         // Level 2 should not be present in the HTML output.
    164158        $this->assertStringNotContainsString(
    165159            sprintf(
     
    168162            ),
    169163            $menu_html,
    170             'Level 2 should not be present in the HTML output'
     164            'Level 2 should not be present in the HTML output.'
    171165        );
    172166    }
Note: See TracChangeset for help on using the changeset viewer.