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/post/output.php

    r51568 r52010  
    99class Tests_Post_Output extends WP_UnitTestCase {
    1010
    11         function set_up() {
     11        public function set_up() {
    1212                parent::set_up();
    13                 add_shortcode( 'dumptag', array( $this, '_shortcode_dumptag' ) );
    14                 add_shortcode( 'paragraph', array( $this, '_shortcode_paragraph' ) );
    15         }
    16 
    17         function tear_down() {
     13                add_shortcode( 'dumptag', array( $this, 'shortcode_dumptag' ) );
     14                add_shortcode( 'paragraph', array( $this, 'shortcode_paragraph' ) );
     15        }
     16
     17        public function tear_down() {
    1818                global $shortcode_tags;
    1919                unset( $shortcode_tags['dumptag'], $shortcode_tags['paragraph'] );
     
    2121        }
    2222
    23         function _shortcode_dumptag( $atts ) {
     23        public function shortcode_dumptag( $atts ) {
    2424                $out = '';
    2525                foreach ( $atts as $k => $v ) {
     
    2929        }
    3030
    31         function _shortcode_paragraph( $atts, $content ) {
     31        public function shortcode_paragraph( $atts, $content ) {
    3232                $processed_atts = shortcode_atts(
    3333                        array(
     
    4040        }
    4141
    42         function test_the_content() {
     42        public function test_the_content() {
    4343                $post_content = <<<EOF
    4444<i>This is the excerpt.</i>
     
    6363        }
    6464
    65         function test_the_content_shortcode() {
     65        public function test_the_content_shortcode() {
    6666                $post_content = <<<EOF
    6767[dumptag foo="bar" baz="123"]
     
    9191        }
    9292
    93         function test_the_content_shortcode_paragraph() {
     93        public function test_the_content_shortcode_paragraph() {
    9494                $post_content = <<<EOF
    9595Graf by itself:
     
    129129        }
    130130
    131         function test_the_content_attribute_filtering() {
     131        public function test_the_content_attribute_filtering() {
    132132                kses_init_filters();
    133133
     
    153153        }
    154154
    155         function test_the_content_attribute_value_with_colon() {
     155        public function test_the_content_attribute_value_with_colon() {
    156156                kses_init_filters();
    157157
Note: See TracChangeset for help on using the changeset viewer.