Make WordPress Core


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

    r51397 r52010  
    1414     * @covers WP_Http::make_absolute_url
    1515     */
    16     function test_make_absolute_url( $relative_url, $absolute_url, $expected ) {
     16    public function test_make_absolute_url( $relative_url, $absolute_url, $expected ) {
    1717        $actual = WP_Http::make_absolute_url( $relative_url, $absolute_url );
    1818        $this->assertSame( $expected, $actual );
    1919    }
    2020
    21     function make_absolute_url_testcases() {
     21    public function make_absolute_url_testcases() {
    2222        // 0: The Location header, 1: The current URL, 3: The expected URL.
    2323        return array(
     
    7575     * @covers ::wp_parse_url
    7676     */
    77     function test_wp_parse_url( $url, $expected ) {
     77    public function test_wp_parse_url( $url, $expected ) {
    7878        $actual = wp_parse_url( $url );
    7979        $this->assertSame( $expected, $actual );
    8080    }
    8181
    82     function parse_url_testcases() {
     82    public function parse_url_testcases() {
    8383        // 0: The URL, 1: The expected resulting structure.
    8484        return array(
     
    188188     * @covers ::wp_parse_url
    189189     */
    190     function test_wp_parse_url_with_default_component() {
     190    public function test_wp_parse_url_with_default_component() {
    191191        $actual = wp_parse_url( self::FULL_TEST_URL, -1 );
    192192        $this->assertSame(
     
    212212     * @covers ::wp_parse_url
    213213     */
    214     function test_wp_parse_url_with_component( $url, $component, $expected ) {
     214    public function test_wp_parse_url_with_component( $url, $component, $expected ) {
    215215        $actual = wp_parse_url( $url, $component );
    216216        $this->assertSame( $expected, $actual );
    217217    }
    218218
    219     function parse_url_component_testcases() {
     219    public function parse_url_component_testcases() {
    220220        // 0: The URL, 1: The requested component, 2: The expected resulting structure.
    221221        return array(
     
    329329     * @covers ::_get_component_from_parsed_url_array
    330330     */
    331     function test_get_component_from_parsed_url_array( $url, $component, $expected ) {
     331    public function test_get_component_from_parsed_url_array( $url, $component, $expected ) {
    332332        $parts  = wp_parse_url( $url );
    333333        $actual = _get_component_from_parsed_url_array( $parts, $component );
     
    335335    }
    336336
    337     function get_component_from_parsed_url_array_testcases() {
     337    public function get_component_from_parsed_url_array_testcases() {
    338338        // 0: A URL, 1: PHP URL constant, 2: The expected result.
    339339        return array(
     
    370370     * @covers ::_wp_translate_php_url_constant_to_key
    371371     */
    372     function test_wp_translate_php_url_constant_to_key( $input, $expected ) {
     372    public function test_wp_translate_php_url_constant_to_key( $input, $expected ) {
    373373        $actual = _wp_translate_php_url_constant_to_key( $input );
    374374        $this->assertSame( $expected, $actual );
    375375    }
    376376
    377     function wp_translate_php_url_constant_to_key_testcases() {
     377    public function wp_translate_php_url_constant_to_key_testcases() {
    378378        // 0: PHP URL constant, 1: The expected result.
    379379        return array(
Note: See TracChangeset for help on using the changeset viewer.