/** * @see WP_Customize_Section::maybe_render() */ function test_maybe_render() { wp_set_current_user(self::$admin_id); $section = new WP_Customize_Section($this->manager, 'bar'); $customize_render_section_count = did_action('customize_render_section'); add_action('customize_render_section', array($this, 'action_customize_render_section_test')); ob_start(); $section->maybe_render(); $content = ob_get_clean(); $this->assertTrue($section->check_capabilities()); $this->assertEmpty($content); $this->assertEquals($customize_render_section_count + 1, did_action('customize_render_section'), 'Unexpected did_action count for customize_render_section'); $this->assertEquals(1, did_action("customize_render_section_{$section->id}"), "Unexpected did_action count for customize_render_section_{$section->id}"); }