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/formatting/redirect.php

    r51568 r52010  
    77 */
    88class Tests_Formatting_Redirect extends WP_UnitTestCase {
    9     function set_up() {
     9    public function set_up() {
    1010        parent::set_up();
    1111        add_filter( 'home_url', array( $this, 'home_url' ) );
    1212    }
    1313
    14     function home_url() {
     14    public function home_url() {
    1515        return 'http://example.com/';
    1616    }
     
    4242    }
    4343
    44     function test_wp_sanitize_redirect() {
     44    public function test_wp_sanitize_redirect() {
    4545        $this->assertSame( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0Ago' ) );
    4646        $this->assertSame( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0ago' ) );
     
    6161     * @ticket 36998
    6262     */
    63     function test_wp_sanitize_redirect_should_encode_spaces() {
     63    public function test_wp_sanitize_redirect_should_encode_spaces() {
    6464        $this->assertSame( 'http://example.com/test%20spaces', wp_sanitize_redirect( 'http://example.com/test%20spaces' ) );
    6565        $this->assertSame( 'http://example.com/test%20spaces%20in%20url', wp_sanitize_redirect( 'http://example.com/test spaces in url' ) );
     
    6969     * @dataProvider valid_url_provider
    7070     */
    71     function test_wp_validate_redirect_valid_url( $url, $expected ) {
     71    public function test_wp_validate_redirect_valid_url( $url, $expected ) {
    7272        $this->assertSame( $expected, wp_validate_redirect( $url ) );
    7373    }
     
    7676     * @dataProvider invalid_url_provider
    7777     */
    78     function test_wp_validate_redirect_invalid_url( $url ) {
     78    public function test_wp_validate_redirect_invalid_url( $url ) {
    7979        $this->assertEquals( false, wp_validate_redirect( $url, false ) );
    8080    }
    8181
    82     function valid_url_provider() {
     82    public function valid_url_provider() {
    8383        return array(
    8484            array( 'http://example.com', 'http://example.com' ),
     
    9696    }
    9797
    98     function invalid_url_provider() {
     98    public function invalid_url_provider() {
    9999        return array(
    100100            // parse_url() fails.
     
    168168     * @dataProvider relative_url_provider
    169169     */
    170     function test_wp_validate_redirect_relative_url( $current_uri, $url, $expected ) {
     170    public function test_wp_validate_redirect_relative_url( $current_uri, $url, $expected ) {
    171171        // Backup the global.
    172172        $unset = false;
     
    199199     * }
    200200     */
    201     function relative_url_provider() {
     201    public function relative_url_provider() {
    202202        return array(
    203203            array(
Note: See TracChangeset for help on using the changeset viewer.