Changeset 58812
- Timestamp:
- 07/26/2024 07:54:26 AM (3 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-walker.php
r57848 r58812 136 136 } 137 137 138 $max_depth = (int) $max_depth; 139 $depth = (int) $depth; 140 138 141 $id_field = $this->db_fields['id']; 139 142 $id = $element->$id_field; … … 191 194 public function walk( $elements, $max_depth, ...$args ) { 192 195 $output = ''; 196 197 $max_depth = (int) $max_depth; 193 198 194 199 // Invalid parameter or nothing to walk. … … 286 291 */ 287 292 public function paged_walk( $elements, $max_depth, $page_num, $per_page, ...$args ) { 293 $output = ''; 294 295 $max_depth = (int) $max_depth; 296 288 297 if ( empty( $elements ) || $max_depth < -1 ) { 289 return ''; 290 } 291 292 $output = ''; 298 return $output; 299 } 293 300 294 301 $parent_field = $this->db_fields['parent']; -
trunk/tests/phpunit/tests/post/wpListPages.php
r55589 r58812 161 161 } 162 162 163 /** 164 * @ticket 61749 165 */ 166 public function test_wp_list_pages_depth_equals_zero() { 167 $expected = '<li class="pagenav">Pages<ul><li class="page_item page-item-' . self::$parent_1 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_1 ) . '">Parent 1</a> 168 <ul class=\'children\'> 169 <li class="page_item page-item-' . self::$children[ self::$parent_1 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][0] ) . '">Child 1</a></li> 170 <li class="page_item page-item-' . self::$children[ self::$parent_1 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][1] ) . '">Child 2</a></li> 171 <li class="page_item page-item-' . self::$children[ self::$parent_1 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][2] ) . '">Child 3</a></li> 172 </ul> 173 </li> 174 <li class="page_item page-item-' . self::$parent_2 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_2 ) . '">Parent 2</a> 175 <ul class=\'children\'> 176 <li class="page_item page-item-' . self::$children[ self::$parent_2 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][0] ) . '">Child 1</a></li> 177 <li class="page_item page-item-' . self::$children[ self::$parent_2 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][1] ) . '">Child 2</a></li> 178 <li class="page_item page-item-' . self::$children[ self::$parent_2 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][2] ) . '">Child 3</a></li> 179 </ul> 180 </li> 181 <li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a> 182 <ul class=\'children\'> 183 <li class="page_item page-item-' . self::$children[ self::$parent_3 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][0] ) . '">Child 1</a></li> 184 <li class="page_item page-item-' . self::$children[ self::$parent_3 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][1] ) . '">Child 2</a></li> 185 <li class="page_item page-item-' . self::$children[ self::$parent_3 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][2] ) . '">Child 3</a></li> 186 </ul> 187 </li> 188 </ul></li>'; 189 190 // Execute wp_list_pages() with a string to force calling wp_parse_args(). 191 ob_start(); 192 wp_list_pages( 'depth=0' ); 193 $output = ob_get_clean(); 194 195 // If depth equals 0, all levels should be displayed. 196 $this->assertSameIgnoreEOL( $expected, $output ); 197 } 198 163 199 public function test_wp_list_pages_show_date() { 164 200 $args = array(
Note: See TracChangeset
for help on using the changeset viewer.