Changeset 55591 for trunk/tests/phpunit/tests/post/nav-menu.php
- Timestamp:
- 03/24/2023 05:10:44 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/nav-menu.php
r55562 r55591 14 14 15 15 $this->menu_id = wp_create_nav_menu( 'foo' ); 16 } 17 18 /** 19 * @ticket 11095 20 * @ticket 33974 21 */ 22 public function test_wp_page_menu_wp_nav_menu_fallback() { 23 $pages = self::factory()->post->create_many( 3, array( 'post_type' => 'page' ) ); 24 25 // No menus + wp_nav_menu() falls back to wp_page_menu(). 26 $menu = wp_nav_menu( array( 'echo' => false ) ); 27 28 // After falling back, the 'before' argument should be set and output as '<ul>'. 29 $this->assertMatchesRegularExpression( '/<div class="menu"><ul>/', $menu ); 30 31 // After falling back, the 'after' argument should be set and output as '</ul>'. 32 $this->assertMatchesRegularExpression( '/<\/ul><\/div>/', $menu ); 33 34 // After falling back, the markup should include whitespace around <li>'s. 35 $this->assertMatchesRegularExpression( '/\s<li.*>|<\/li>\s/U', $menu ); 36 $this->assertDoesNotMatchRegularExpression( '/><li.*>|<\/li></U', $menu ); 37 38 // No menus + wp_nav_menu() falls back to wp_page_menu(), this time without a container. 39 $menu = wp_nav_menu( 40 array( 41 'echo' => false, 42 'container' => false, 43 ) 44 ); 45 46 // After falling back, the empty 'container' argument should still return a container element. 47 $this->assertMatchesRegularExpression( '/<div class="menu">/', $menu ); 48 49 // No menus + wp_nav_menu() falls back to wp_page_menu(), this time without white-space. 50 $menu = wp_nav_menu( 51 array( 52 'echo' => false, 53 'item_spacing' => 'discard', 54 ) 55 ); 56 57 // After falling back, the markup should not include whitespace around <li>'s. 58 $this->assertDoesNotMatchRegularExpression( '/\s<li.*>|<\/li>\s/U', $menu ); 59 $this->assertMatchesRegularExpression( '/><li.*>|<\/li></U', $menu ); 60 16 61 } 17 62 … … 718 763 } 719 764 720 721 765 /** 722 766 * @ticket 35272
Note: See TracChangeset
for help on using the changeset viewer.