mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-14 09:34:41 +00:00
Coding Standards: Add visibility to methods in tests/phpunit/tests/.
Adds a `public` visibility to test fixtures, tests, data providers, and callbacks methods. Adds a `private` visibility to helper methods within test classes. Renames callbacks and helpers that previously started with a `_` prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit. Props costdev, jrf, hellofromTonya. Fixes #54177. git-svn-id: https://develop.svn.wordpress.org/trunk@52010 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -19,7 +19,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
*/
|
||||
protected $manager;
|
||||
|
||||
function set_up() {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
@@ -27,7 +27,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
$this->undefined = new stdClass();
|
||||
}
|
||||
|
||||
function tear_down() {
|
||||
public function tear_down() {
|
||||
$this->manager = null;
|
||||
unset( $GLOBALS['wp_customize'] );
|
||||
parent::tear_down();
|
||||
@@ -36,7 +36,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
/**
|
||||
* @see WP_Customize_Section::__construct()
|
||||
*/
|
||||
function test_construct_default_args() {
|
||||
public function test_construct_default_args() {
|
||||
$section = new WP_Customize_Section( $this->manager, 'foo' );
|
||||
$this->assertIsInt( $section->instance_number );
|
||||
$this->assertSame( $this->manager, $section->manager );
|
||||
@@ -54,7 +54,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
/**
|
||||
* @see WP_Customize_Section::__construct()
|
||||
*/
|
||||
function test_construct_custom_args() {
|
||||
public function test_construct_custom_args() {
|
||||
$args = array(
|
||||
'priority' => 200,
|
||||
'capability' => 'edit_posts',
|
||||
@@ -77,7 +77,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
/**
|
||||
* @see WP_Customize_Section::__construct()
|
||||
*/
|
||||
function test_construct_custom_type() {
|
||||
public function test_construct_custom_type() {
|
||||
$section = new Custom_Section_Test( $this->manager, 'foo' );
|
||||
$this->assertSame( 'titleless', $section->type );
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
* @see WP_Customize_Section::active()
|
||||
* @see WP_Customize_Section::active_callback()
|
||||
*/
|
||||
function test_active() {
|
||||
public function test_active() {
|
||||
$section = new WP_Customize_Section( $this->manager, 'foo' );
|
||||
$this->assertTrue( $section->active() );
|
||||
|
||||
@@ -107,7 +107,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
* @param WP_Customize_Section $section
|
||||
* @return bool
|
||||
*/
|
||||
function filter_active_test( $active, $section ) {
|
||||
public function filter_active_test( $active, $section ) {
|
||||
$this->assertFalse( $active );
|
||||
$this->assertInstanceOf( 'WP_Customize_Section', $section );
|
||||
$active = true;
|
||||
@@ -117,7 +117,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
/**
|
||||
* @see WP_Customize_Section::json()
|
||||
*/
|
||||
function test_json() {
|
||||
public function test_json() {
|
||||
$args = array(
|
||||
'priority' => 200,
|
||||
'capability' => 'edit_posts',
|
||||
@@ -145,7 +145,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
/**
|
||||
* @see WP_Customize_Section::check_capabilities()
|
||||
*/
|
||||
function test_check_capabilities() {
|
||||
public function test_check_capabilities() {
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$section = new WP_Customize_Section( $this->manager, 'foo' );
|
||||
@@ -162,7 +162,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
/**
|
||||
* @see WP_Customize_Section::get_content()
|
||||
*/
|
||||
function test_get_content() {
|
||||
public function test_get_content() {
|
||||
$section = new WP_Customize_Section( $this->manager, 'foo' );
|
||||
$this->assertEmpty( $section->get_content() );
|
||||
}
|
||||
@@ -170,7 +170,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
/**
|
||||
* @see WP_Customize_Section::maybe_render()
|
||||
*/
|
||||
function test_maybe_render() {
|
||||
public 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' );
|
||||
@@ -188,14 +188,14 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
* @see WP_Customize_Section::maybe_render()
|
||||
* @param WP_Customize_Section $section
|
||||
*/
|
||||
function action_customize_render_section_test( $section ) {
|
||||
public function action_customize_render_section_test( $section ) {
|
||||
$this->assertInstanceOf( 'WP_Customize_Section', $section );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see WP_Customize_Section::print_template()
|
||||
*/
|
||||
function test_print_templates_standard() {
|
||||
public function test_print_templates_standard() {
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$section = new WP_Customize_Section( $this->manager, 'baz' );
|
||||
@@ -210,7 +210,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
/**
|
||||
* @see WP_Customize_Section::print_template()
|
||||
*/
|
||||
function test_print_templates_custom() {
|
||||
public function test_print_templates_custom() {
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$section = new Custom_Section_Test( $this->manager, 'baz' );
|
||||
|
||||
Reference in New Issue
Block a user