| | 345 | |
| | 346 | /** |
| | 347 | * @ticket 4969 |
| | 348 | */ |
| | 349 | function test_wp_get_pages_before_and_after() { |
| | 350 | $expected = '<div>The Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> |
| | 351 | <ul class=\'children\'> |
| | 352 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li> |
| | 353 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li> |
| | 354 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li> |
| | 355 | </ul> |
| | 356 | </li> |
| | 357 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> |
| | 358 | <ul class=\'children\'> |
| | 359 | <li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li> |
| | 360 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li> |
| | 361 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li> |
| | 362 | </ul> |
| | 363 | </li> |
| | 364 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> |
| | 365 | <ul class=\'children\'> |
| | 366 | <li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li> |
| | 367 | <li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li> |
| | 368 | <li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li> |
| | 369 | </ul> |
| | 370 | </li> |
| | 371 | </ul></div>'; |
| | 372 | |
| | 373 | $result = trim( wp_list_pages( |
| | 374 | array( |
| | 375 | 'echo' => false, |
| | 376 | 'before' => '<div>', |
| | 377 | 'after' => '</div>', |
| | 378 | 'title_li' => 'The Pages' |
| | 379 | ) |
| | 380 | ) ); |
| | 381 | |
| | 382 | $this->assertEquals( $expected, $result ); |
| | 383 | } |