Changeset 55562 for trunk/tests/phpunit/tests/post/nav-menu.php
- Timestamp:
- 03/19/2023 12:03:30 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/nav-menu.php
r55035 r55562 967 967 968 968 /** 969 * @ticket 43401 970 * @dataProvider data_iri_current_menu_item 971 */ 972 public function test_iri_current_menu_item( $custom_link, $current = true ) { 973 wp_update_nav_menu_item( 974 $this->menu_id, 975 0, 976 array( 977 'menu-item-status' => 'publish', 978 'menu-item-type' => 'custom', 979 'menu-item-url' => $custom_link, 980 ) 981 ); 982 983 $this->go_to( site_url( '/%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82/' ) ); 984 985 $menu_items = wp_get_nav_menu_items( $this->menu_id ); 986 _wp_menu_item_classes_by_context( $menu_items ); 987 988 $classes = $menu_items[0]->classes; 989 990 if ( $current ) { 991 $this->assertContains( 'current-menu-item', $classes ); 992 } else { 993 $this->assertNotContains( 'current-menu-item', $classes ); 994 } 995 } 996 997 /** 969 998 * Provides IRI matching data for _wp_menu_item_classes_by_context() test. 970 999 */ 971 public function get_iri_current_menu_items() {1000 public function data_iri_current_menu_item() { 972 1001 return array( 973 1002 array( site_url( '/%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82/' ) ), … … 981 1010 982 1011 /** 983 * @ticket 43401984 * @dataProvider get_iri_current_menu_items985 */986 public function test_iri_current_menu_item( $custom_link, $current = true ) {987 wp_update_nav_menu_item(988 $this->menu_id,989 0,990 array(991 'menu-item-status' => 'publish',992 'menu-item-type' => 'custom',993 'menu-item-url' => $custom_link,994 )995 );996 997 $this->go_to( site_url( '/%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82/' ) );998 999 $menu_items = wp_get_nav_menu_items( $this->menu_id );1000 _wp_menu_item_classes_by_context( $menu_items );1001 1002 $classes = $menu_items[0]->classes;1003 1004 if ( $current ) {1005 $this->assertContains( 'current-menu-item', $classes );1006 } else {1007 $this->assertNotContains( 'current-menu-item', $classes );1008 }1009 }1010 1011 /**1012 1012 * @ticket 44005 1013 1013 * @group privacy
Note: See TracChangeset
for help on using the changeset viewer.