Make WordPress Core

Changeset 52009


Ignore:
Timestamp:
11/04/2021 01:15:33 PM (3 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add public visibility to methods in tests/phpunit/includes/.

This commit adds the public visibility keyword to each method which did not have an explicit visibility keyword.

Why public?

With no visibility previously declared, these methods are implicitly public and available for use. As these are part of the WordPress testing framework (for Core and extenders), changing them to anything else would be a backwards-compatibility break.

Props costdev, jrf, hellofromTonya.
See #54177.

Location:
trunk/tests/phpunit/includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/bootstrap.php

    r51828 r52009  
    341341class WP_PHPUnit_Util_Getopt {
    342342
    343     function __construct( $argv ) {
     343    public function __construct( $argv ) {
    344344        $skipped_groups = array(
    345345            'ajax'          => true,
  • trunk/tests/phpunit/includes/mock-fs.php

    r47122 r52009  
    1414    public $method  = 'MockFS';
    1515
    16     function __construct() {}
    17 
    18     function connect() {
     16    public function __construct() {}
     17
     18    public function connect() {
    1919        return true;
    2020    }
    2121
    2222    // Copy of core's function, but accepts a path.
    23     function abspath( $path = false ) {
     23    public function abspath( $path = false ) {
    2424        if ( ! $path ) {
    2525            $path = ABSPATH;
     
    4141     * Can also be passed the initial filesystem to be setup which is passed to self::setfs()
    4242     */
    43     function init( $paths = '', $home_dir = '/' ) {
     43    public function init( $paths = '', $home_dir = '/' ) {
    4444        $this->fs     = new MockFS_Directory_Node( '/' );
    4545        $this->fs_map = array(
     
    5454     * "Bulk Loads" a filesystem into the internal virtual filesystem
    5555     */
    56     function setfs( $paths ) {
     56    public function setfs( $paths ) {
    5757        if ( ! is_array( $paths ) ) {
    5858            $paths = explode( "\n", $paths );
     
    9494    // Here starteth the WP_Filesystem functions.
    9595
    96     function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
     96    public function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
    9797        $path = trailingslashit( $path );
    9898
     
    115115    }
    116116
    117     function put_contents( $path, $contents = '', $mode = null ) {
     117    public function put_contents( $path, $contents = '', $mode = null ) {
    118118        if ( ! $this->is_dir( dirname( $path ) ) ) {
    119119            $this->mkdir( dirname( $path ) );
     
    127127    }
    128128
    129     function get_contents( $file ) {
     129    public function get_contents( $file ) {
    130130        if ( ! $this->is_file( $file ) ) {
    131131            return false;
     
    134134    }
    135135
    136     function cwd() {
     136    public function cwd() {
    137137        return $this->cwd->path;
    138138    }
    139139
    140     function chdir( $path ) {
     140    public function chdir( $path ) {
    141141        if ( ! isset( $this->fs_map[ $path ] ) ) {
    142142            return false;
     
    147147    }
    148148
    149     function exists( $path ) {
     149    public function exists( $path ) {
    150150        return isset( $this->fs_map[ $path ] ) || isset( $this->fs_map[ trailingslashit( $path ) ] );
    151151    }
    152152
    153     function is_file( $file ) {
     153    public function is_file( $file ) {
    154154        return isset( $this->fs_map[ $file ] ) && $this->fs_map[ $file ]->is_file();
    155155    }
    156156
    157     function is_dir( $path ) {
     157    public function is_dir( $path ) {
    158158        $path = trailingslashit( $path );
    159159
     
    161161    }
    162162
    163     function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
     163    public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
    164164
    165165        if ( empty( $path ) || '.' === $path ) {
     
    215215    public $path; // The full path to the entry.
    216216
    217     function __construct( $path ) {
     217    public function __construct( $path ) {
    218218        $this->path = $path;
    219219        $this->name = basename( $path );
    220220    }
    221221
    222     function is_file() {
     222    public function is_file() {
    223223        return 'f' === $this->type;
    224224    }
    225225
    226     function is_dir() {
     226    public function is_dir() {
    227227        return 'd' === $this->type;
    228228    }
     
    238238    public $contents = ''; // The contents of the file.
    239239
    240     function __construct( $path, $contents = '' ) {
     240    public function __construct( $path, $contents = '' ) {
    241241        parent::__construct( $path );
    242242        $this->contents = $contents;
  • trunk/tests/phpunit/includes/mock-mailer.php

    r50265 r52009  
    66    public $mock_sent = array();
    77
    8     function preSend() {
     8    public function preSend() {
    99        $this->Encoding = '8bit';
    1010        return parent::preSend();
     
    1414     * Override postSend() so mail isn't actually sent.
    1515     */
    16     function postSend() {
     16    public function postSend() {
    1717        $this->mock_sent[] = array(
    1818            'to'      => $this->to,
  • trunk/tests/phpunit/includes/testcase-xmlrpc.php

    r51585 r52009  
    77    protected $myxmlrpcserver;
    88
    9     function set_up() {
     9    public function set_up() {
    1010        parent::set_up();
    1111
     
    1515    }
    1616
    17     function tear_down() {
     17    public function tear_down() {
    1818        remove_filter( 'pre_option_enable_xmlrpc', '__return_true' );
    1919
  • trunk/tests/phpunit/includes/utils.php

    r51552 r52009  
    6565     * PHP5 constructor.
    6666     */
    67     function __construct( $debug = 0 ) {
     67    public function __construct( $debug = 0 ) {
    6868        $this->reset();
    6969        $this->debug = $debug;
    7070    }
    7171
    72     function reset() {
     72    public function reset() {
    7373        $this->events = array();
    7474    }
    7575
    76     function current_filter() {
     76    public function current_filter() {
    7777        if ( is_callable( 'current_filter' ) ) {
    7878            return current_filter();
     
    8282    }
    8383
    84     function action( $arg ) {
     84    public function action( $arg ) {
    8585        if ( $this->debug ) {
    8686            dmp( __FUNCTION__, $this->current_filter() );
     
    9595    }
    9696
    97     function action2( $arg ) {
     97    public function action2( $arg ) {
    9898        if ( $this->debug ) {
    9999            dmp( __FUNCTION__, $this->current_filter() );
     
    109109    }
    110110
    111     function filter( $arg ) {
     111    public function filter( $arg ) {
    112112        if ( $this->debug ) {
    113113            dmp( __FUNCTION__, $this->current_filter() );
     
    123123    }
    124124
    125     function filter2( $arg ) {
     125    public function filter2( $arg ) {
    126126        if ( $this->debug ) {
    127127            dmp( __FUNCTION__, $this->current_filter() );
     
    137137    }
    138138
    139     function filter_append( $arg ) {
     139    public function filter_append( $arg ) {
    140140        if ( $this->debug ) {
    141141            dmp( __FUNCTION__, $this->current_filter() );
     
    151151    }
    152152
    153     function filterall( $tag, ...$args ) {
     153    public function filterall( $tag, ...$args ) {
    154154        // This one doesn't return the result, so it's safe to use with the new 'all' filter.
    155155        if ( $this->debug ) {
     
    165165
    166166    // Return a list of all the actions, tags and args.
    167     function get_events() {
     167    public function get_events() {
    168168        return $this->events;
    169169    }
    170170
    171171    // Return a count of the number of times the action was called since the last reset.
    172     function get_call_count( $tag = '' ) {
     172    public function get_call_count( $tag = '' ) {
    173173        if ( $tag ) {
    174174            $count = 0;
     
    184184
    185185    // Return an array of the tags that triggered calls to this action.
    186     function get_tags() {
     186    public function get_tags() {
    187187        $out = array();
    188188        foreach ( $this->events as $e ) {
     
    193193
    194194    // Return an array of args passed in calls to this action.
    195     function get_args() {
     195    public function get_args() {
    196196        $out = array();
    197197        foreach ( $this->events as $e ) {
     
    211211     * PHP5 constructor.
    212212     */
    213     function __construct( $in ) {
     213    public function __construct( $in ) {
    214214        $this->xml = xml_parser_create();
    215215        xml_set_object( $this->xml, $this );
     
    220220    }
    221221
    222     function parse( $in ) {
     222    public function parse( $in ) {
    223223        $parse = xml_parse( $this->xml, $in, true );
    224224        if ( ! $parse ) {
     
    236236    }
    237237
    238     function start_handler( $parser, $name, $attributes ) {
     238    public function start_handler( $parser, $name, $attributes ) {
    239239        $data['name'] = $name;
    240240        if ( $attributes ) {
     
    243243    }
    244244
    245     function data_handler( $parser, $data ) {
     245    public function data_handler( $parser, $data ) {
    246246        $index = count( $this->data ) - 1;
    247247
     
    252252    }
    253253
    254     function end_handler( $parser, $name ) {
     254    public function end_handler( $parser, $name ) {
    255255        if ( count( $this->data ) > 1 ) {
    256256            $data                            = array_pop( $this->data );
Note: See TracChangeset for help on using the changeset viewer.