Changeset 54809 for branches/6.1/tests/phpunit/tests/menu/wp-nav-menu.php
- Timestamp:
- 11/11/2022 02:40:54 AM (2 years ago)
- Location:
- branches/6.1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.1
-
branches/6.1/tests/phpunit/tests/menu/wp-nav-menu.php
r54808 r54809 12 12 static $lvl1_menu_item = 0; 13 13 static $lvl2_menu_item = 0; 14 static $lvl3_menu_item = 0; 14 15 15 16 public static function set_up_before_class() { … … 50 51 'menu-item-url' => '#', 51 52 'menu-item-parent-id' => self::$lvl1_menu_item, 53 'menu-item-status' => 'publish', 54 ) 55 ); 56 57 // Create lvl3 menu item. 58 self::$lvl3_menu_item = wp_update_nav_menu_item( 59 self::$menu_id, 60 0, 61 array( 62 'menu-item-title' => 'Lvl3 menu item', 63 'menu-item-url' => '#', 64 'menu-item-parent-id' => self::$lvl2_menu_item, 52 65 'menu-item-status' => 'publish', 53 66 ) … … 82 95 * 83 96 * @ticket 28620 97 * @ticket 56946 84 98 */ 85 99 public function test_wp_nav_menu_should_have_has_children_class_without_custom_depth() { … … 113 127 $this->assertStringContainsString( 114 128 sprintf( 129 '<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">', 130 self::$lvl2_menu_item 131 ), 132 $menu_html, 133 'Level 2 should be present in the HTML output and have the `menu-item-has-children` class.' 134 ); 135 136 $this->assertStringContainsString( 137 sprintf( 115 138 '<li id="menu-item-%1$d" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-%1$d">', 116 self::$lvl 2_menu_item117 ), 118 $menu_html, 119 'Level 2should be present in the HTML output and not have the `menu-item-has-children` class since it has no children.'139 self::$lvl3_menu_item 140 ), 141 $menu_html, 142 'Level 3 should be present in the HTML output and not have the `menu-item-has-children` class since it has no children.' 120 143 ); 121 144 } … … 126 149 * 127 150 * @ticket 28620 151 * @ticket 56946 128 152 */ 129 153 public function test_wp_nav_menu_should_not_have_has_children_class_with_custom_depth() { … … 133 157 array( 134 158 'menu' => self::$menu_id, 135 'depth' => 2,159 'depth' => 3, 136 160 'echo' => false, 137 161 ) … … 149 173 $this->assertStringContainsString( 150 174 sprintf( 175 '<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">', 176 self::$lvl1_menu_item 177 ), 178 $menu_html, 179 'Level 1 should be present in the HTML output and have the `menu-item-has-children` class.' 180 ); 181 182 $this->assertStringContainsString( 183 sprintf( 151 184 '<li id="menu-item-%1$d" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-%1$d">', 152 self::$lvl 1_menu_item153 ), 154 $menu_html, 155 'Level 1should be present in the HTML output and not have the `menu-item-has-children` class since it is the last item to be rendered.'185 self::$lvl2_menu_item 186 ), 187 $menu_html, 188 'Level 2 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.' 156 189 ); 157 190 … … 159 192 sprintf( 160 193 '<li id="menu-item-%d"', 161 self::$lvl 2_menu_item162 ), 163 $menu_html, 164 'Level 2should not be present in the HTML output.'194 self::$lvl3_menu_item 195 ), 196 $menu_html, 197 'Level 3 should not be present in the HTML output.' 165 198 ); 166 199 }
Note: See TracChangeset
for help on using the changeset viewer.