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/http/base.php

    r51568 r52010  
    1818    protected $http_request_args;
    1919
    20     function set_up() {
     20    public function set_up() {
    2121        parent::set_up();
    2222
     
    3535    }
    3636
    37     function filter_http_request_args( array $args ) {
     37    public function filter_http_request_args( array $args ) {
    3838        $this->http_request_args = $args;
    3939        return $args;
     
    4343     * @covers ::wp_remote_request
    4444     */
    45     function test_redirect_on_301() {
     45    public function test_redirect_on_301() {
    4646        // 5 : 5 & 301.
    4747        $res = wp_remote_request( $this->redirection_script . '?code=301&rt=' . 5, array( 'redirection' => 5 ) );
     
    5555     * @covers ::wp_remote_request
    5656     */
    57     function test_redirect_on_302() {
     57    public function test_redirect_on_302() {
    5858        // 5 : 5 & 302.
    5959        $res = wp_remote_request( $this->redirection_script . '?code=302&rt=' . 5, array( 'redirection' => 5 ) );
     
    6969     * @covers ::wp_remote_request
    7070     */
    71     function test_redirect_on_301_no_redirect() {
     71    public function test_redirect_on_301_no_redirect() {
    7272        // 5 > 0 & 301.
    7373        $res = wp_remote_request( $this->redirection_script . '?code=301&rt=' . 5, array( 'redirection' => 0 ) );
     
    8383     * @covers ::wp_remote_request
    8484     */
    85     function test_redirect_on_302_no_redirect() {
     85    public function test_redirect_on_302_no_redirect() {
    8686        // 5 > 0 & 302.
    8787        $res = wp_remote_request( $this->redirection_script . '?code=302&rt=' . 5, array( 'redirection' => 0 ) );
     
    9595     * @covers ::wp_remote_request
    9696     */
    97     function test_redirections_equal() {
     97    public function test_redirections_equal() {
    9898        // 5 - 5.
    9999        $res = wp_remote_request( $this->redirection_script . '?rt=' . 5, array( 'redirection' => 5 ) );
     
    107107     * @covers ::wp_remote_request
    108108     */
    109     function test_no_head_redirections() {
     109    public function test_no_head_redirections() {
    110110        // No redirections on HEAD request.
    111111        $res = wp_remote_request( $this->redirection_script . '?code=302&rt=' . 1, array( 'method' => 'HEAD' ) );
     
    121121     * @covers ::wp_remote_request
    122122     */
    123     function test_redirect_on_head() {
     123    public function test_redirect_on_head() {
    124124        // Redirections on HEAD request when Requested.
    125125        $res = wp_remote_request(
     
    139139     * @covers ::wp_remote_request
    140140     */
    141     function test_redirections_greater() {
     141    public function test_redirections_greater() {
    142142        // 10 > 5.
    143143        $res = wp_remote_request( $this->redirection_script . '?rt=' . 10, array( 'redirection' => 5 ) );
     
    150150     * @covers ::wp_remote_request
    151151     */
    152     function test_redirections_greater_edgecase() {
     152    public function test_redirections_greater_edgecase() {
    153153        // 6 > 5 (close edge case).
    154154        $res = wp_remote_request( $this->redirection_script . '?rt=' . 6, array( 'redirection' => 5 ) );
     
    161161     * @covers ::wp_remote_request
    162162     */
    163     function test_redirections_less_edgecase() {
     163    public function test_redirections_less_edgecase() {
    164164        // 4 < 5 (close edge case).
    165165        $res = wp_remote_request( $this->redirection_script . '?rt=' . 4, array( 'redirection' => 5 ) );
     
    174174     * @covers ::wp_remote_request
    175175     */
    176     function test_redirections_zero_redirections_specified() {
     176    public function test_redirections_zero_redirections_specified() {
    177177        // 0 redirections asked for, should return the document?
    178178        $res = wp_remote_request( $this->redirection_script . '?code=302&rt=' . 5, array( 'redirection' => 0 ) );
     
    190190     * @covers ::wp_remote_request
    191191     */
    192     function test_location_header_on_201() {
     192    public function test_location_header_on_201() {
    193193        // Prints PASS on initial load, FAIL if the client follows the specified redirection.
    194194        $res = wp_remote_request( $this->redirection_script . '?201-location=true' );
     
    207207     * @covers ::wp_remote_retrieve_body
    208208     */
    209     function test_no_redirection_on_PUT() {
     209    public function test_no_redirection_on_PUT() {
    210210        $url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?201-location=1';
    211211
     
    229229     * @covers ::wp_remote_request
    230230     */
    231     function test_send_headers() {
     231    public function test_send_headers() {
    232232        // Test that the headers sent are received by the server.
    233233        $headers = array(
     
    264264     * @covers ::wp_remote_request
    265265     */
    266     function test_file_stream() {
     266    public function test_file_stream() {
    267267        $url  = $this->file_stream_url;
    268268        $size = 153204;
     
    294294     * @covers ::wp_remote_request
    295295     */
    296     function test_file_stream_limited_size() {
     296    public function test_file_stream_limited_size() {
    297297        $url  = $this->file_stream_url;
    298298        $size = 10000;
     
    325325     * @covers ::wp_remote_request
    326326     */
    327     function test_request_limited_size() {
     327    public function test_request_limited_size() {
    328328        $url  = $this->file_stream_url;
    329329        $size = 10000;
     
    352352     * @covers ::wp_remote_retrieve_body
    353353     */
    354     function test_post_redirect_to_method_300( $response_code, $method ) {
     354    public function test_post_redirect_to_method_300( $response_code, $method ) {
    355355        $url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?post-redirect-to-method=1';
    356356
     
    394394     * @covers ::wp_remote_retrieve_body
    395395     */
    396     function test_ip_url_with_host_header() {
     396    public function test_ip_url_with_host_header() {
    397397        $ip   = gethostbyname( 'api.wordpress.org' );
    398398        $url  = 'http://' . $ip . '/core/tests/1.0/redirection.php?print-pass=1';
     
    419419     * @covers ::wp_remote_head
    420420     */
    421     function test_https_url_without_ssl_verification() {
     421    public function test_https_url_without_ssl_verification() {
    422422        $url  = 'https://wordpress.org/';
    423423        $args = array(
     
    446446     * @covers ::wp_remote_retrieve_body
    447447     */
    448     function test_multiple_location_headers() {
     448    public function test_multiple_location_headers() {
    449449        $url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?multiple-location-headers=1';
    450450        $res = wp_remote_head( $url, array( 'timeout' => 30 ) );
     
    469469     * @covers ::wp_remote_retrieve_body
    470470     */
    471     function test_cookie_handling() {
     471    public function test_cookie_handling() {
    472472        $url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?cookie-test=1';
    473473
     
    486486     * @covers ::wp_remote_get
    487487     */
    488     function test_ssl() {
     488    public function test_ssl() {
    489489        if ( ! wp_http_supports( array( 'ssl' ) ) ) {
    490490            $this->fail( 'This installation of PHP does not support SSL.' );
     
    502502     * @covers ::wp_remote_request
    503503     */
    504     function test_url_with_double_slashes_path() {
     504    public function test_url_with_double_slashes_path() {
    505505        $url = $this->redirection_script . '?rt=' . 0;
    506506
Note: See TracChangeset for help on using the changeset viewer.