- Timestamp:
- 11/01/2022 08:15:25 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/menu/wp-nav-menu.php
r54478 r54741 54 54 ); 55 55 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()`. 59 60 * 60 * To allow the tests to pass, we remove the filter before running them and add it back after61 * 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()}). 62 63 */ 63 64 remove_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once' ); … … 67 68 wp_delete_nav_menu( self::$menu_id ); 68 69 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}). 71 73 */ 72 74 add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 ); … … 76 78 77 79 /** 78 * Test all menu items containing children have the CSS class `menu-item-has-children` when displaying the menu79 * w ithout 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. 80 82 * 81 83 * @ticket 28620 … … 91 93 ); 92 94 93 // Level 0 should be present in the HTML output and have the `menu-item-has-children` class.94 95 $this->assertStringContainsString( 95 96 sprintf( … … 98 99 ), 99 100 $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.' 101 102 ); 102 103 103 // Level 1 should be present in the HTML output and have the `menu-item-has-children` class.104 104 $this->assertStringContainsString( 105 105 sprintf( … … 108 108 ), 109 109 $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.' 111 111 ); 112 112 113 // Level 2 should be present in the HTML output and not have the `menu-item-has-children` class since it has no114 // children.115 113 $this->assertStringContainsString( 116 114 sprintf( … … 119 117 ), 120 118 $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.' 122 120 ); 123 121 } … … 140 138 ); 141 139 142 // Level 0 should be present in the HTML output and have the `menu-item-has-children` class.143 140 $this->assertStringContainsString( 144 141 sprintf( … … 147 144 ), 148 145 $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.' 150 147 ); 151 148 152 // Level 1 should be present in the HTML output and not have the `menu-item-has-children` class since its the153 // last item to be rendered.154 149 $this->assertStringContainsString( 155 150 sprintf( … … 158 153 ), 159 154 $menu_html, 160 'Level 1 should be present in the HTML output and not have the `menu-item-has-children` class since it s 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.' 161 156 ); 162 157 163 // Level 2 should not be present in the HTML output.164 158 $this->assertStringNotContainsString( 165 159 sprintf( … … 168 162 ), 169 163 $menu_html, 170 'Level 2 should not be present in the HTML output '164 'Level 2 should not be present in the HTML output.' 171 165 ); 172 166 }
Note: See TracChangeset
for help on using the changeset viewer.