Changeset 36889 for trunk/tests/phpunit/tests/customize/nav-menus.php
- Timestamp:
- 03/09/2016 12:08:51 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/nav-menus.php
r36782 r36889 618 618 do_action( 'customize_register', $this->wp_customize ); 619 619 $menus = $this->wp_customize->nav_menus; 620 $menu_id = wp_create_nav_menu( 'Foo' ); 620 621 621 622 $results = $menus->filter_wp_nav_menu_args( array( … … 623 624 'fallback_cb' => 'wp_page_menu', 624 625 'walker' => '', 625 'menu' => wp_create_nav_menu( 'Foo' ),626 'menu' => $menu_id, 626 627 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 627 628 ) ); 628 629 $this->assertArrayHasKey( 'customize_preview_nav_menus_args', $results ); 630 $this->assertTrue( $results['can_partial_refresh'] ); 629 631 630 632 $results = $menus->filter_wp_nav_menu_args( array( … … 634 636 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 635 637 ) ); 636 $this->assertArrayNotHasKey( 'customize_preview_nav_menus_args', $results ); 638 $this->assertFalse( $results['can_partial_refresh'] ); 639 $this->assertArrayHasKey( 'customize_preview_nav_menus_args', $results ); 637 640 $this->assertEquals( 'wp_page_menu', $results['fallback_cb'] ); 638 641 … … 645 648 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 646 649 ) ); 650 $this->assertTrue( $results['can_partial_refresh'] ); 647 651 $this->assertArrayHasKey( 'customize_preview_nav_menus_args', $results ); 648 652 $this->assertEquals( $nav_menu_term->term_id, $results['customize_preview_nav_menus_args']['menu'] ); 653 654 $results = $menus->filter_wp_nav_menu_args( array( 655 'echo' => true, 656 'fallback_cb' => 'wp_page_menu', 657 'walker' => '', 658 'menu' => $menu_id, 659 'container' => 'div', 660 'items_wrap' => '%3$s', 661 ) ); 662 $this->assertTrue( $results['can_partial_refresh'] ); 663 664 $results = $menus->filter_wp_nav_menu_args( array( 665 'echo' => true, 666 'fallback_cb' => 'wp_page_menu', 667 'walker' => '', 668 'menu' => $menu_id, 669 'container' => false, 670 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 671 ) ); 672 $this->assertTrue( $results['can_partial_refresh'] ); 673 674 $results = $menus->filter_wp_nav_menu_args( array( 675 'echo' => true, 676 'fallback_cb' => 'wp_page_menu', 677 'walker' => '', 678 'menu' => $menu_id, 679 'container' => false, 680 'items_wrap' => '%3$s', 681 ) ); 682 $this->assertFalse( $results['can_partial_refresh'] ); 649 683 } 650 684 … … 692 726 693 727 /** 728 * Test WP_Customize_Nav_Menus::export_preview_data() method. 729 * 730 * @see WP_Customize_Nav_Menus::export_preview_data() 731 */ 732 function test_export_preview_data() { 733 ob_start(); 734 $this->wp_customize->nav_menus->export_preview_data(); 735 $html = ob_get_clean(); 736 $this->assertTrue( (bool) preg_match( '/_wpCustomizePreviewNavMenusExports = ({.+})/s', $html, $matches ) ); 737 $exported_data = json_decode( $matches[1], true ); 738 $this->assertArrayHasKey( 'navMenuInstanceArgs', $exported_data ); 739 } 740 741 /** 694 742 * Test WP_Customize_Nav_Menus::render_nav_menu_partial() method. 695 743 *
Note: See TracChangeset
for help on using the changeset viewer.