- Timestamp:
- 10/20/2015 07:07:58 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php
r35242 r35302 93 93 'original_title' => '', 94 94 'nav_menu_term_id' => 0, 95 '_invalid' => false, 95 96 ); 96 97 $this->assertEquals( $default, $setting->default ); … … 459 460 'original_title' => 'Hi<script>alert(1)</script>', 460 461 'nav_menu_term_id' => 'heilo', 462 '_invalid' => false, 461 463 ); 462 464 … … 665 667 } 666 668 669 /** 670 * @ticket 33665 671 */ 672 function test_invalid_nav_menu_item() { 673 $menu_id = wp_create_nav_menu( 'Primary' ); 674 register_post_type( 'poem', array( 675 'public' => true, 676 ) ); 677 678 $post_id = self::factory()->post->create( array( 'post_type' => 'poem', 'post_title' => 'Code is poetry.' ) ); 679 $post = get_post( $post_id ); 680 $item_id = wp_update_nav_menu_item( $menu_id, 0, array( 681 'menu-item-type' => 'post_type', 682 'menu-item-object' => 'poem', 683 'menu-item-object-id' => $post_id, 684 'menu-item-title' => $post->post_title, 685 'menu-item-status' => 'publish', 686 'menu-item-position' => 1, 687 ) ); 688 $setting_id = "nav_menu_item[$item_id]"; 689 690 do_action( 'customize_register', $this->wp_customize ); 691 $setting = $this->wp_customize->get_setting( $setting_id ); 692 $this->assertNotEmpty( $setting ); 693 $value = $setting->value(); 694 $this->assertFalse( $value['_invalid'] ); 695 $value_object = $setting->value_as_wp_post_nav_menu_item(); 696 $this->assertFalse( $value_object->_invalid ); 697 698 $setting = new WP_Customize_Nav_Menu_Item_Setting( $this->wp_customize, $setting_id ); 699 $value = $setting->value(); 700 $this->assertFalse( $value['_invalid'] ); 701 $value_object = $setting->value_as_wp_post_nav_menu_item(); 702 $this->assertFalse( $value_object->_invalid ); 703 704 _unregister_post_type( 'poem' ); 705 $setting = new WP_Customize_Nav_Menu_Item_Setting( $this->wp_customize, $setting_id ); 706 $value = $setting->value(); 707 $this->assertTrue( $value['_invalid'] ); 708 $value_object = $setting->value_as_wp_post_nav_menu_item(); 709 $this->assertTrue( $value_object->_invalid ); 710 } 711 667 712 }
Note: See TracChangeset
for help on using the changeset viewer.