Changeset 42343 for trunk/tests/phpunit/tests/customize/panel.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/panel.php
r35242 r42343 17 17 require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' ); 18 18 $GLOBALS['wp_customize'] = new WP_Customize_Manager(); 19 $this->manager = $GLOBALS['wp_customize'];20 $this->undefined = new stdClass();19 $this->manager = $GLOBALS['wp_customize']; 20 $this->undefined = new stdClass(); 21 21 } 22 22 … … 50 50 function test_construct_custom_args() { 51 51 $args = array( 52 'priority' => 200,53 'capability' => 'edit_posts',54 'theme_supports' => 'html5',55 'title' => 'Hello World',56 'description' => 'Lorem Ipsum',57 'type' => 'horizontal',52 'priority' => 200, 53 'capability' => 'edit_posts', 54 'theme_supports' => 'html5', 55 'title' => 'Hello World', 56 'description' => 'Lorem Ipsum', 57 'type' => 'horizontal', 58 58 'active_callback' => '__return_true', 59 59 ); … … 81 81 $this->assertTrue( $panel->active() ); 82 82 83 $panel = new WP_Customize_Panel( $this->manager, 'foo', array( 84 'active_callback' => '__return_false', 85 ) ); 83 $panel = new WP_Customize_Panel( 84 $this->manager, 'foo', array( 85 'active_callback' => '__return_false', 86 ) 87 ); 86 88 $this->assertFalse( $panel->active() ); 87 89 add_filter( 'customize_panel_active', array( $this, 'filter_active_test' ), 10, 2 ); … … 105 107 */ 106 108 function test_json() { 107 $args = array(108 'priority' => 200,109 'capability' => 'edit_posts',110 'theme_supports' => 'html5',111 'title' => 'Hello World',112 'description' => 'Lorem Ipsum',113 'type' => 'horizontal',109 $args = array( 110 'priority' => 200, 111 'capability' => 'edit_posts', 112 'theme_supports' => 'html5', 113 'title' => 'Hello World', 114 'description' => 'Lorem Ipsum', 115 'type' => 'horizontal', 114 116 'active_callback' => '__return_true', 115 117 ); 116 118 $panel = new WP_Customize_Panel( $this->manager, 'foo', $args ); 117 $data = $panel->json();119 $data = $panel->json(); 118 120 $this->assertEquals( 'foo', $data['id'] ); 119 121 foreach ( array( 'title', 'description', 'priority', 'type' ) as $key ) { … … 134 136 $panel = new WP_Customize_Panel( $this->manager, 'foo' ); 135 137 $this->assertTrue( $panel->check_capabilities() ); 136 $old_cap = $panel->capability;138 $old_cap = $panel->capability; 137 139 $panel->capability = 'do_not_allow'; 138 140 $this->assertFalse( $panel->check_capabilities() ); … … 156 158 function test_maybe_render() { 157 159 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 158 $panel = new WP_Customize_Panel( $this->manager, 'bar' );160 $panel = new WP_Customize_Panel( $this->manager, 'bar' ); 159 161 $customize_render_panel_count = did_action( 'customize_render_panel' ); 160 162 add_action( 'customize_render_panel', array( $this, 'action_customize_render_panel_test' ) );
Note: See TracChangeset
for help on using the changeset viewer.