Changeset 55328 for trunk/tests/phpunit/tests/menu/wp-nav-menu.php
- Timestamp:
- 02/14/2023 03:30:58 AM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/menu/wp-nav-menu.php
r54890 r55328 198 198 ); 199 199 } 200 201 /** 202 * The order in which parent/child menu items are created should not matter. 203 * 204 * @ticket 57122 205 */ 206 public function test_parent_with_higher_id_should_not_error() { 207 // Create a new level zero menu item. 208 $new_lvl0_menu_item = wp_update_nav_menu_item( 209 self::$menu_id, 210 0, 211 array( 212 'menu-item-title' => 'Root menu item with high ID', 213 'menu-item-url' => '#', 214 'menu-item-status' => 'publish', 215 ) 216 ); 217 218 // Reparent level 1 menu item to the new level zero menu item. 219 self::$lvl1_menu_item = wp_update_nav_menu_item( 220 self::$menu_id, 221 self::$lvl1_menu_item, 222 array( 223 'menu-item-parent-id' => $new_lvl0_menu_item, 224 ) 225 ); 226 227 // Delete the old level zero menu item. 228 wp_delete_post( self::$lvl0_menu_item, true ); 229 230 // Render the menu. 231 $menu_html = wp_nav_menu( 232 array( 233 'menu' => self::$menu_id, 234 'echo' => false, 235 ) 236 ); 237 238 $this->assertStringContainsString( 239 sprintf( 240 '<li id="menu-item-%1$d" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-%1$d">', 241 $new_lvl0_menu_item 242 ), 243 $menu_html, 244 'The level zero menu item should appear in the menu.' 245 ); 246 247 } 200 248 }
Note: See TracChangeset
for help on using the changeset viewer.