Tests: Add a test for the 'before' and 'after' arguments in wp_page_menu()
when used as a fallback for wp_nav_menu()
.
When `wp_page_menu()` is used as a fallback for `wp_nav_menu()`, the `before` and `after` arguments should be set and output as `<ul>` and `</ul>`, respectively. See #11095. See [34653]. git-svn-id: https://develop.svn.wordpress.org/trunk@34654 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a155c5dcfd
commit
416dc6642a
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @group template
|
||||
*/
|
||||
class Tests_Post_Template extends WP_UnitTestCase {
|
||||
|
||||
function test_wp_link_pages() {
|
||||
@ -275,4 +278,20 @@ NO;
|
||||
$this->go_to( get_permalink( $post_id ) );
|
||||
$this->assertFalse( get_page_template_slug() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 11095
|
||||
*/
|
||||
public function test_wp_page_menu_wp_nav_menu_fallback() {
|
||||
$pages = $this->factory->post->create_many( 3, array( 'post_type' => 'page' ) );
|
||||
|
||||
// No menus + wp_nav_menu() falls back to wp_page_menu().
|
||||
$menu = wp_nav_menu( array( 'echo' => false ) );
|
||||
|
||||
// After falling back, the 'before' argument should be set and output as '<ul>'.
|
||||
$this->assertRegExp( '/<div class="menu"><ul>/', $menu );
|
||||
|
||||
// After falling back, the 'after' argument should be set and output as '</ul>'.
|
||||
$this->assertRegExp( '/<\/ul><\/div>/', $menu );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user