Created
October 26, 2016 18:21
-
-
Save christophherr/91e961aefe4b3961a745016f7f0a26b8 to your computer and use it in GitHub Desktop.
Forth unit test 35272
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test_class_not_applied_to_page_item() { | |
$page_id1 = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Home Page' ) ); | |
update_option( 'page_on_front', $page_id1 ); | |
$page_id2 = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Test Page' ) ); | |
wp_update_nav_menu_item( $this->menu_id, 0, array( | |
'menu-item-type' => 'post_type', | |
'menu-item-object' => 'page', | |
'menu-item-object-id' => $page_id1, | |
'menu-item-status' => 'publish', | |
)); | |
wp_update_nav_menu_item( $this->menu_id, 0, array( | |
'menu-item-type' => 'post_type', | |
'menu-item-object' => 'page', | |
'menu-item-object-id' => $page_id2, | |
'menu-item-status' => 'publish', | |
)); | |
$permalink = get_permalink( $page_id2 ); | |
$this->go_to( $permalink ); | |
$menu_items = wp_get_nav_menu_items( $this->menu_id ); | |
_wp_menu_item_classes_by_context( $menu_items ); | |
$classes = $menu_items[1]->classes; | |
delete_option( 'page_on_front' ); | |
$this->assertNotContains( 'menu-item-home', $classes ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment