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/functions/wpGetArchives.php

    r51568 r52010  
    1010    protected $year_url;
    1111
    12     function set_up() {
     12    public function set_up() {
    1313        parent::set_up();
    1414
     
    2727    }
    2828
    29     function test_wp_get_archives_default() {
     29    public function test_wp_get_archives_default() {
    3030        $expected['default'] = "<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></li>';
    3131        $this->assertSame( $expected['default'], trim( wp_get_archives( array( 'echo' => false ) ) ) );
    3232    }
    3333
    34     function test_wp_get_archives_type() {
     34    public function test_wp_get_archives_type() {
    3535        $expected['type'] = "<li><a href='" . $this->year_url . "'>" . gmdate( 'Y' ) . '</a></li>';
    3636        $this->assertSame(
     
    4747    }
    4848
    49     function test_wp_get_archives_limit() {
     49    public function test_wp_get_archives_limit() {
    5050        $ids = array_slice( array_reverse( self::$post_ids ), 0, 5 );
    5151
     
    8383    }
    8484
    85     function test_wp_get_archives_format() {
     85    public function test_wp_get_archives_format() {
    8686        $expected['format'] = "<option value='" . $this->month_url . "'> " . gmdate( 'F Y' ) . ' </option>';
    8787        $this->assertSame(
     
    9898    }
    9999
    100     function test_wp_get_archives_before_and_after() {
     100    public function test_wp_get_archives_before_and_after() {
    101101        $expected['before_and_after'] = "<div><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></div>';
    102102        $this->assertSame(
     
    115115    }
    116116
    117     function test_wp_get_archives_show_post_count() {
     117    public function test_wp_get_archives_show_post_count() {
    118118        $expected['show_post_count'] = "<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a>&nbsp;(8)</li>';
    119119        $this->assertSame(
     
    130130    }
    131131
    132     function test_wp_get_archives_echo() {
     132    public function test_wp_get_archives_echo() {
    133133        $expected['echo'] = "\t<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></li>' . "\n";
    134134        $this->expectOutputString( $expected['echo'] );
     
    136136    }
    137137
    138     function test_wp_get_archives_order() {
     138    public function test_wp_get_archives_order() {
    139139        self::factory()->post->create(
    140140            array(
     
    183183     * @ticket 21596
    184184     */
    185     function test_wp_get_archives_post_type() {
     185    public function test_wp_get_archives_post_type() {
    186186        register_post_type( 'taco', array( 'public' => true ) );
    187187
Note: See TracChangeset for help on using the changeset viewer.