Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 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/url.php

    r51568 r52010  
    88class Tests_URL extends WP_UnitTestCase {
    99
    10     function set_up() {
     10    public function set_up() {
    1111        parent::set_up();
    1212        $GLOBALS['pagenow'] = '';
     
    1616     * @dataProvider data_is_ssl
    1717     */
    18     function test_is_ssl( $value, $expected ) {
     18    public function test_is_ssl( $value, $expected ) {
    1919        $_SERVER['HTTPS'] = $value;
    2020
     
    2323    }
    2424
    25     function data_is_ssl() {
     25    public function data_is_ssl() {
    2626        return array(
    2727            array(
     
    4848    }
    4949
    50     function test_is_ssl_by_port() {
     50    public function test_is_ssl_by_port() {
    5151        unset( $_SERVER['HTTPS'] );
    5252        $_SERVER['SERVER_PORT'] = '443';
     
    5656    }
    5757
    58     function test_is_ssl_with_no_value() {
     58    public function test_is_ssl_with_no_value() {
    5959        unset( $_SERVER['HTTPS'] );
    6060
     
    6969     * @param string $expected Expected result.
    7070     */
    71     function test_admin_url( $url, $expected ) {
     71    public function test_admin_url( $url, $expected ) {
    7272        $siteurl_http   = get_option( 'siteurl' );
    7373        $admin_url_http = admin_url( $url );
     
    8282    }
    8383
    84     function data_admin_urls() {
     84    public function data_admin_urls() {
    8585        return array(
    8686            array(
     
    137137     * @param string $expected Expected result.
    138138     */
    139     function test_home_url( $url, $expected ) {
     139    public function test_home_url( $url, $expected ) {
    140140        $homeurl_http  = get_option( 'home' );
    141141        $home_url_http = home_url( $url );
     
    150150    }
    151151
    152     function data_home_urls() {
     152    public function data_home_urls() {
    153153        return array(
    154154            array(
     
    199199    }
    200200
    201     function test_home_url_from_admin() {
     201    public function test_home_url_from_admin() {
    202202        // Pretend to be in the site admin.
    203203        set_current_screen( 'dashboard' );
     
    244244    }
    245245
    246     function test_network_home_url_from_admin() {
     246    public function test_network_home_url_from_admin() {
    247247        // Pretend to be in the site admin.
    248248        set_current_screen( 'dashboard' );
     
    265265    }
    266266
    267     function test_set_url_scheme() {
     267    public function test_set_url_scheme() {
    268268        $links = array(
    269269            'http://wordpress.org/',
Note: See TracChangeset for help on using the changeset viewer.