Changeset 41811
- Timestamp:
- 10/10/2017 05:07:31 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/nav-menu.php
r41801 r41811 1085 1085 */ 1086 1086 function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ) { 1087 $registered_nav_menus = get_registered_nav_menus(); 1087 $registered_nav_menus = get_registered_nav_menus(); 1088 $new_nav_menu_locations = array_intersect_key( $new_nav_menu_locations, $registered_nav_menus ); 1088 1089 1089 1090 // Short-circuit if there are no old nav menu location assignments to map. -
trunk/tests/phpunit/tests/menu/nav-menu.php
r41237 r41811 49 49 50 50 /** 51 * Only registered locations should be mapped and returned. 52 * 53 * @covers wp_map_nav_menu_locations() 54 */ 55 function test_filter_registered_locations() { 56 $this->register_nav_menu_locations( array( 'primary', 'secondary' ) ); 57 $old_next_theme_nav_menu_locations = $prev_theme_nav_menu_locations = array( 58 'primary' => 1, 59 'secondary' => 2, 60 'social' => 3, 61 ); 62 $new_next_theme_nav_menu_locations = wp_map_nav_menu_locations( $old_next_theme_nav_menu_locations, $prev_theme_nav_menu_locations ); 63 64 $expected_nav_menu_locations = array( 65 'primary' => 1, 66 'secondary' => 2, 67 ); 68 $this->assertEquals( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations ); 69 } 70 71 /** 51 72 * Locations with the same name should map, switching to a theme not previously-active. 52 73 *
Note: See TracChangeset
for help on using the changeset viewer.