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/comment/template.php

    r49863 r52010  
    2020        }
    2121
    22         function test_get_comments_number() {
     22        public function test_get_comments_number() {
    2323                $post_id = self::$post_id;
    2424
     
    3333        }
    3434
    35         function test_get_comments_number_without_arg() {
     35        public function test_get_comments_number_without_arg() {
    3636                $post_id   = self::$post_id;
    3737                $permalink = get_permalink( $post_id );
     
    4949         * @ticket 48772
    5050         */
    51         function test_get_comments_number_text_with_post_id() {
     51        public function test_get_comments_number_text_with_post_id() {
    5252                $post_id = self::$post_id;
    5353                $this->factory->comment->create_post_comments( $post_id, 6 );
     
    6868         * @ticket 13651
    6969         */
    70         function test_get_comments_number_text_declension_with_default_args() {
     70        public function test_get_comments_number_text_declension_with_default_args() {
    7171                $post_id   = self::$post_id;
    7272                $permalink = get_permalink( $post_id );
     
    9191         * @dataProvider data_get_comments_number_text_declension
    9292         */
    93         function test_get_comments_number_text_declension_with_custom_args( $number, $input, $output ) {
     93        public function test_get_comments_number_text_declension_with_custom_args( $number, $input, $output ) {
    9494                $post_id   = self::$post_id;
    9595                $permalink = get_permalink( $post_id );
     
    9898                $this->go_to( $permalink );
    9999
    100                 add_filter( 'gettext_with_context', array( $this, '_enable_comment_number_declension' ), 10, 4 );
     100                add_filter( 'gettext_with_context', array( $this, 'enable_comment_number_declension' ), 10, 4 );
    101101
    102102                $this->assertSame( $output, get_comments_number_text( false, false, $input ) );
    103103
    104                 remove_filter( 'gettext_with_context', array( $this, '_enable_comment_number_declension' ), 10, 4 );
     104                remove_filter( 'gettext_with_context', array( $this, 'enable_comment_number_declension' ), 10, 4 );
    105105        }
    106106
    107         function _enable_comment_number_declension( $translation, $text, $context, $domain ) {
     107        public function enable_comment_number_declension( $translation, $text, $context, $domain ) {
    108108                if ( 'Comment number declension: on or off' === $context ) {
    109109                        $translation = 'on';
     
    124124         * }
    125125         */
    126         function data_get_comments_number_text_declension() {
     126        public function data_get_comments_number_text_declension() {
    127127                return array(
    128128                        array(
Note: See TracChangeset for help on using the changeset viewer.