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/link.php

    r51587 r52010  
    55class Tests_Link extends WP_UnitTestCase {
    66
    7     function _get_pagenum_link_cb( $url ) {
     7    public function get_pagenum_link_cb( $url ) {
    88        return $url . '/WooHoo';
    99    }
     
    1212     * @ticket 8847
    1313     */
    14     function test_get_pagenum_link_case_insensitivity() {
     14    public function test_get_pagenum_link_case_insensitivity() {
    1515        $old_req_uri = $_SERVER['REQUEST_URI'];
    1616
    1717        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    1818
    19         add_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
     19        add_filter( 'home_url', array( $this, 'get_pagenum_link_cb' ) );
    2020        $_SERVER['REQUEST_URI'] = '/woohoo';
    2121        $paged                  = get_pagenum_link( 2 );
    2222
    23         remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
     23        remove_filter( 'home_url', array( $this, 'get_pagenum_link_cb' ) );
    2424        $this->assertSame( $paged, home_url( '/WooHoo/page/2/' ) );
    2525
     
    2727    }
    2828
    29     function test_wp_get_shortlink() {
     29    public function test_wp_get_shortlink() {
    3030        $post_id  = self::factory()->post->create();
    3131        $post_id2 = self::factory()->post->create();
     
    7171    }
    7272
    73     function test_wp_get_shortlink_with_page() {
     73    public function test_wp_get_shortlink_with_page() {
    7474        $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    7575
     
    8686     * @ticket 26871
    8787     */
    88     function test_wp_get_shortlink_with_home_page() {
     88    public function test_wp_get_shortlink_with_home_page() {
    8989        $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    9090        update_option( 'show_on_front', 'page' );
Note: See TracChangeset for help on using the changeset viewer.