Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (5 years ago)
Author:
hellofromTonya
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/panel.php

    r51568 r52010  
    1313        protected $manager;
    1414
    15         function set_up() {
     15        public function set_up() {
    1616                parent::set_up();
    1717                require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    … …  
    2121        }
    2222
    23         function tear_down() {
     23        public function tear_down() {
    2424                $this->manager = null;
    2525                unset( $GLOBALS['wp_customize'] );
    … …  
    3030         * @see WP_Customize_Panel::__construct()
    3131         */
    32         function test_construct_default_args() {
     32        public function test_construct_default_args() {
    3333                $panel = new WP_Customize_Panel( $this->manager, 'foo' );
    3434                $this->assertIsInt( $panel->instance_number );
    … …  
    4848         * @see WP_Customize_Panel::__construct()
    4949         */
    50         function test_construct_custom_args() {
     50        public function test_construct_custom_args() {
    5151                $args = array(
    5252                        'priority'        => 200,
    … …  
    6868         * @see WP_Customize_Panel::__construct()
    6969         */
    70         function test_construct_custom_type() {
     70        public function test_construct_custom_type() {
    7171                $panel = new Custom_Panel_Test( $this->manager, 'foo' );
    7272                $this->assertSame( 'titleless', $panel->type );
    … …  
    7777         * @see WP_Customize_Panel::active_callback()
    7878         */
    79         function test_active() {
     79        public function test_active() {
    8080                $panel = new WP_Customize_Panel( $this->manager, 'foo' );
    8181                $this->assertTrue( $panel->active() );
    … …  
    9898         * @return bool
    9999         */
    100         function filter_active_test( $active, $panel ) {
     100        public function filter_active_test( $active, $panel ) {
    101101                $this->assertFalse( $active );
    102102                $this->assertInstanceOf( 'WP_Customize_Panel', $panel );
    … …  
    108108         * @see WP_Customize_Panel::json()
    109109         */
    110         function test_json() {
     110        public function test_json() {
    111111                $args  = array(
    112112                        'priority'        => 200,
    … …  
    132132         * @see WP_Customize_Panel::check_capabilities()
    133133         */
    134         function test_check_capabilities() {
     134        public function test_check_capabilities() {
    135135                $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
    136136                wp_set_current_user( $user_id );
    … …  
    150150         * @see WP_Customize_Panel::get_content()
    151151         */
    152         function test_get_content() {
     152        public function test_get_content() {
    153153                $panel = new WP_Customize_Panel( $this->manager, 'foo' );
    154154                $this->assertEmpty( $panel->get_content() );
    … …  
    158158         * @see WP_Customize_Panel::maybe_render()
    159159         */
    160         function test_maybe_render() {
     160        public function test_maybe_render() {
    161161                wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    162162                $panel                        = new WP_Customize_Panel( $this->manager, 'bar' );
    … …  
    176176         * @param WP_Customize_Panel $panel
    177177         */
    178         function action_customize_render_panel_test( $panel ) {
     178        public function action_customize_render_panel_test( $panel ) {
    179179                $this->assertInstanceOf( 'WP_Customize_Panel', $panel );
    180180        }
    … …  
    183183         * @see WP_Customize_Panel::print_template()
    184184         */
    185         function test_print_templates_standard() {
     185        public function test_print_templates_standard() {
    186186                wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    187187
    … …  
    201201         * @see WP_Customize_Panel::print_template()
    202202         */
    203         function test_print_templates_custom() {
     203        public function test_print_templates_custom() {
    204204                wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    205205
Note: See TracChangeset for help on using the changeset viewer.