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/query/isTerm.php

    r51568 r52010  
    2323    protected $tax;
    2424
    25     function set_up() {
     25    public function set_up() {
    2626        parent::set_up();
    2727
     
    6464    }
    6565
    66     function test_tag_action_tax() {
     66    public function test_tag_action_tax() {
    6767        // Tag with taxonomy added.
    6868        $this->go_to( home_url( '/tag/tag-slug/' ) );
     
    7575    }
    7676
    77     function test_tag_query_cat_action_tax() {
     77    public function test_tag_query_cat_action_tax() {
    7878        // Tag + category with taxonomy added.
    7979        $this->go_to( home_url( "/tag/tag-slug/?cat=$this->cat_id" ) );
     
    8787    }
    8888
    89     function test_tag_query_cat_query_tax_action_tax() {
     89    public function test_tag_query_cat_query_tax_action_tax() {
    9090        // Tag + category + tax with taxonomy added.
    9191        $this->go_to( home_url( "/tag/tag-slug/?cat=$this->cat_id&testtax=tax-slug2" ) );
     
    100100    }
    101101
    102     function test_cat_action_tax() {
     102    public function test_cat_action_tax() {
    103103        // Category with taxonomy added.
    104104        $this->go_to( home_url( '/category/cat-slug/' ) );
     
    114114     * @ticket 26627
    115115     */
    116     function test_cat_uncat_action_tax() {
     116    public function test_cat_uncat_action_tax() {
    117117        // Category with taxonomy added.
    118         add_action( 'pre_get_posts', array( $this, '_cat_uncat_action_tax' ), 11 );
     118        add_action( 'pre_get_posts', array( $this, 'cat_uncat_action_tax' ), 11 );
    119119
    120120        $this->go_to( home_url( '/category/uncategorized/' ) );
     
    126126        $this->assertEquals( get_queried_object(), $this->uncat );
    127127
    128         remove_action( 'pre_get_posts', array( $this, '_cat_uncat_action_tax' ), 11 );
    129     }
    130 
    131     function _cat_uncat_action_tax( &$query ) {
     128        remove_action( 'pre_get_posts', array( $this, 'cat_uncat_action_tax' ), 11 );
     129    }
     130
     131    public function cat_uncat_action_tax( &$query ) {
    132132        $this->assertTrue( $query->is_category() );
    133133        $this->assertTrue( $query->is_archive() );
     
    140140     * @ticket 26728
    141141     */
    142     function test_tax_action_tax() {
     142    public function test_tax_action_tax() {
    143143        // Taxonomy with taxonomy added.
    144144        $this->go_to( home_url( '/testtax/tax-slug2/' ) );
     
    150150    }
    151151
    152     function test_tax_query_tag_action_tax() {
     152    public function test_tax_query_tag_action_tax() {
    153153        // Taxonomy + tag with taxonomy added.
    154154        $this->go_to( home_url( "/testtax/tax-slug2/?tag_id=$this->tag_id" ) );
     
    161161    }
    162162
    163     function test_tax_query_cat_action_tax() {
     163    public function test_tax_query_cat_action_tax() {
    164164        // Taxonomy + category with taxonomy added.
    165165        $this->go_to( home_url( "/testtax/tax-slug2/?cat=$this->cat_id" ) );
     
    172172    }
    173173
    174     function pre_get_posts_tax_category_tax_query( &$query ) {
     174    public function pre_get_posts_tax_category_tax_query( &$query ) {
    175175        $query->set(
    176176            'tax_query',
Note: See TracChangeset for help on using the changeset viewer.