@@ 157-169 (lines=13) @@ | ||
154 | /** |
|
155 | * @see WP_Customize_Panel::maybe_render() |
|
156 | */ |
|
157 | function test_maybe_render() { |
|
158 | wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); |
|
159 | $panel = new WP_Customize_Panel( $this->manager, 'bar' ); |
|
160 | $customize_render_panel_count = did_action( 'customize_render_panel' ); |
|
161 | add_action( 'customize_render_panel', array( $this, 'action_customize_render_panel_test' ) ); |
|
162 | ob_start(); |
|
163 | $panel->maybe_render(); |
|
164 | $content = ob_get_clean(); |
|
165 | $this->assertTrue( $panel->check_capabilities() ); |
|
166 | $this->assertEmpty( $content ); |
|
167 | $this->assertEquals( $customize_render_panel_count + 1, did_action( 'customize_render_panel' ), 'Unexpected did_action count for customize_render_panel' ); |
|
168 | $this->assertEquals( 1, did_action( "customize_render_panel_{$panel->id}" ), "Unexpected did_action count for customize_render_panel_{$panel->id}" ); |
|
169 | } |
|
170 | ||
171 | /** |
|
172 | * @see WP_Customize_Panel::maybe_render() |
@@ 164-176 (lines=13) @@ | ||
161 | /** |
|
162 | * @see WP_Customize_Section::maybe_render() |
|
163 | */ |
|
164 | function test_maybe_render() { |
|
165 | wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); |
|
166 | $section = new WP_Customize_Section( $this->manager, 'bar' ); |
|
167 | $customize_render_section_count = did_action( 'customize_render_section' ); |
|
168 | add_action( 'customize_render_section', array( $this, 'action_customize_render_section_test' ) ); |
|
169 | ob_start(); |
|
170 | $section->maybe_render(); |
|
171 | $content = ob_get_clean(); |
|
172 | $this->assertTrue( $section->check_capabilities() ); |
|
173 | $this->assertEmpty( $content ); |
|
174 | $this->assertEquals( $customize_render_section_count + 1, did_action( 'customize_render_section' ), 'Unexpected did_action count for customize_render_section' ); |
|
175 | $this->assertEquals( 1, did_action( "customize_render_section_{$section->id}" ), "Unexpected did_action count for customize_render_section_{$section->id}" ); |
|
176 | } |
|
177 | ||
178 | /** |
|
179 | * @see WP_Customize_Section::maybe_render() |