Changeset 42343 for trunk/tests/phpunit/tests/customize/section.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/section.php
r38398 r42343 23 23 require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' ); 24 24 $GLOBALS['wp_customize'] = new WP_Customize_Manager(); 25 $this->manager = $GLOBALS['wp_customize'];26 $this->undefined = new stdClass();25 $this->manager = $GLOBALS['wp_customize']; 26 $this->undefined = new stdClass(); 27 27 } 28 28 … … 56 56 function test_construct_custom_args() { 57 57 $args = array( 58 'priority' => 200,59 'capability' => 'edit_posts',60 'theme_supports' => 'html5',61 'title' => 'Hello World',62 'description' => 'Lorem Ipsum',63 'type' => 'horizontal',58 'priority' => 200, 59 'capability' => 'edit_posts', 60 'theme_supports' => 'html5', 61 'title' => 'Hello World', 62 'description' => 'Lorem Ipsum', 63 'type' => 'horizontal', 64 64 'active_callback' => '__return_true', 65 'panel' => 'bar',65 'panel' => 'bar', 66 66 ); 67 67 … … 90 90 $this->assertTrue( $section->active() ); 91 91 92 $section = new WP_Customize_Section( $this->manager, 'foo', array( 93 'active_callback' => '__return_false', 94 ) ); 92 $section = new WP_Customize_Section( 93 $this->manager, 'foo', array( 94 'active_callback' => '__return_false', 95 ) 96 ); 95 97 $this->assertFalse( $section->active() ); 96 98 add_filter( 'customize_section_active', array( $this, 'filter_active_test' ), 10, 2 ); … … 115 117 function test_json() { 116 118 $args = array( 117 'priority' => 200,118 'capability' => 'edit_posts',119 'theme_supports' => 'html5',120 'title' => 'Hello World',121 'description' => 'Lorem Ipsum',122 'type' => 'horizontal',123 'panel' => 'bar',119 'priority' => 200, 120 'capability' => 'edit_posts', 121 'theme_supports' => 'html5', 122 'title' => 'Hello World', 123 'description' => 'Lorem Ipsum', 124 'type' => 'horizontal', 125 'panel' => 'bar', 124 126 'active_callback' => '__return_true', 125 127 ); … … 128 130 129 131 $section = new WP_Customize_Section( $this->manager, 'foo', $args ); 130 $data = $section->json();132 $data = $section->json(); 131 133 $this->assertEquals( 'foo', $data['id'] ); 132 134 foreach ( array( 'title', 'description', 'priority', 'panel', 'type' ) as $key ) { … … 146 148 $section = new WP_Customize_Section( $this->manager, 'foo' ); 147 149 $this->assertTrue( $section->check_capabilities() ); 148 $old_cap = $section->capability;150 $old_cap = $section->capability; 149 151 $section->capability = 'do_not_allow'; 150 152 $this->assertFalse( $section->check_capabilities() ); … … 168 170 function test_maybe_render() { 169 171 wp_set_current_user( self::$admin_id ); 170 $section = new WP_Customize_Section( $this->manager, 'bar' );172 $section = new WP_Customize_Section( $this->manager, 'bar' ); 171 173 $customize_render_section_count = did_action( 'customize_render_section' ); 172 174 add_action( 'customize_render_section', array( $this, 'action_customize_render_section_test' ) );
Note: See TracChangeset
for help on using the changeset viewer.