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

    r51568 r52010  
    295295    }
    296296
    297     function set_up() {
     297    public function set_up() {
    298298        parent::set_up();
    299299
     
    302302    }
    303303
    304     function test_query_default() {
     304    public function test_query_default() {
    305305        $posts = $this->q->query( '' );
    306306
     
    322322    }
    323323
    324     function test_query_tag_a() {
     324    public function test_query_tag_a() {
    325325        $posts = $this->q->query( 'tag=tag-a' );
    326326
     
    333333    }
    334334
    335     function test_query_tag_b() {
     335    public function test_query_tag_b() {
    336336        $posts = $this->q->query( 'tag=tag-b' );
    337337
     
    347347     * @ticket 21779
    348348     */
    349     function test_query_tag_nun() {
     349    public function test_query_tag_nun() {
    350350        $posts = $this->q->query( 'tag=tag-נ' );
    351351
     
    355355    }
    356356
    357     function test_query_tag_id() {
     357    public function test_query_tag_id() {
    358358        $tag   = tag_exists( 'tag-a' );
    359359        $posts = $this->q->query( 'tag_id=' . $tag['term_id'] );
     
    367367    }
    368368
    369     function test_query_tag_slug__in() {
     369    public function test_query_tag_slug__in() {
    370370        $posts = $this->q->query( 'tag_slug__in[]=tag-b&tag_slug__in[]=tag-c' );
    371371
     
    381381
    382382
    383     function test_query_tag__in() {
     383    public function test_query_tag__in() {
    384384        $tag_a = tag_exists( 'tag-a' );
    385385        $tag_b = tag_exists( 'tag-b' );
     
    396396    }
    397397
    398     function test_query_tag__not_in() {
     398    public function test_query_tag__not_in() {
    399399        $tag_a = tag_exists( 'tag-a' );
    400400        $posts = $this->q->query( 'tag__not_in[]=' . $tag_a['term_id'] );
     
    418418    }
    419419
    420     function test_query_tag__in_but__not_in() {
     420    public function test_query_tag__in_but__not_in() {
    421421        $tag_a = tag_exists( 'tag-a' );
    422422        $tag_b = tag_exists( 'tag-b' );
     
    431431
    432432
    433     function test_query_category_name() {
     433    public function test_query_category_name() {
    434434        $posts = $this->q->query( 'category_name=cat-a' );
    435435
     
    442442    }
    443443
    444     function test_query_cat() {
     444    public function test_query_cat() {
    445445        $cat   = category_exists( 'cat-b' );
    446446        $posts = $this->q->query( "cat=$cat" );
     
    454454    }
    455455
    456     function test_query_posts_per_page() {
     456    public function test_query_posts_per_page() {
    457457        $posts = $this->q->query( 'posts_per_page=5' );
    458458
     
    469469    }
    470470
    471     function test_query_offset() {
     471    public function test_query_offset() {
    472472        $posts = $this->q->query( 'offset=2' );
    473473
     
    489489    }
    490490
    491     function test_query_paged() {
     491    public function test_query_paged() {
    492492        $posts = $this->q->query( 'paged=2' );
    493493
     
    510510    }
    511511
    512     function test_query_paged_and_posts_per_page() {
     512    public function test_query_paged_and_posts_per_page() {
    513513        $posts = $this->q->query( 'paged=4&posts_per_page=4' );
    514514
     
    528528     * @ticket 11056
    529529     */
    530     function test_query_post_parent__in() {
     530    public function test_query_post_parent__in() {
    531531        // Query for first parent's children.
    532532        $posts = $this->q->query(
     
    595595     * @ticket 11056
    596596     */
    597     function test_query_orderby_post_parent__in() {
     597    public function test_query_orderby_post_parent__in() {
    598598        $posts = $this->q->query(
    599599            array(
     
    618618     * @ticket 39055
    619619     */
    620     function test_query_orderby_post_parent__in_with_order_desc() {
     620    public function test_query_orderby_post_parent__in_with_order_desc() {
    621621        $post_parent__in_array   = array( self::$parent_two, self::$parent_one );
    622622        $expected_returned_array = array( 'child-three', 'child-four', 'child-one', 'child-two' );
     
    637637     * @ticket 39055
    638638     */
    639     function test_query_orderby_post__in_with_no_order_specified() {
     639    public function test_query_orderby_post__in_with_no_order_specified() {
    640640        $post__in_array          = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] );
    641641        $expected_returned_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] );
     
    656656     * @ticket 39055
    657657     */
    658     function test_query_orderby_post__in_with_order_asc() {
     658    public function test_query_orderby_post__in_with_order_asc() {
    659659        $post__in_array          = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] );
    660660        $expected_returned_array = array( self::$post_ids[2], self::$post_ids[0], self::$post_ids[1] );
     
    676676     * @ticket 39055
    677677     */
    678     function test_query_orderby_post__in_with_order_desc() {
     678    public function test_query_orderby_post__in_with_order_desc() {
    679679        $post__in_array          = array( self::$post_ids[1], self::$post_ids[2], self::$post_ids[0] );
    680680        $expected_returned_array = array( self::$post_ids[1], self::$post_ids[2], self::$post_ids[0] );
     
    697697     * @ticket 39055
    698698     */
    699     function test_query_orderby_post_name__in_with_order_asc() {
     699    public function test_query_orderby_post_name__in_with_order_asc() {
    700700        $post_name__in_array = array( 'parent-two', 'parent-one', 'parent-three' );
    701701
     
    714714     * @ticket 39055
    715715     */
    716     function test_query_orderby_post_name__in_with_order_desc() {
     716    public function test_query_orderby_post_name__in_with_order_desc() {
    717717        $post_name__in_array = array( 'parent-two', 'parent-one', 'parent-three' );
    718718
     
    733733     * @ticket 31194
    734734     */
    735     function test_query_fields_integers() {
     735    public function test_query_fields_integers() {
    736736
    737737        $parents = array(
     
    775775     * @ticket 28099
    776776     */
    777     function test_empty_post__in() {
     777    public function test_empty_post__in() {
    778778        $posts1 = $this->q->query( array() );
    779779        $this->assertNotEmpty( $posts1 );
     
    787787     * @ticket 19198
    788788     */
    789     function test_exclude_from_search_empty() {
     789    public function test_exclude_from_search_empty() {
    790790        global $wp_post_types;
    791791        foreach ( array_keys( $wp_post_types ) as $slug ) {
     
    811811     * @ticket 16854
    812812     */
    813     function test_query_author_vars() {
     813    public function test_query_author_vars() {
    814814        $author_1 = self::factory()->user->create(
    815815            array(
     
    983983     * @ticket 10935
    984984     */
    985     function test_query_is_date() {
     985    public function test_query_is_date() {
    986986        $this->q->query(
    987987            array(
     
    10411041    }
    10421042
    1043     function test_perm_with_status_array() {
     1043    public function test_perm_with_status_array() {
    10441044        global $wpdb;
    10451045        $this->q->query(
     
    10601060     * @ticket 20308
    10611061     */
    1062     function test_post_password() {
     1062    public function test_post_password() {
    10631063        $one   = (string) self::factory()->post->create( array( 'post_password' => '' ) );
    10641064        $two   = (string) self::factory()->post->create( array( 'post_password' => 'burrito' ) );
     
    11511151     * @ticket 28611
    11521152     */
    1153     function test_duplicate_slug_in_hierarchical_post_type() {
     1153    public function test_duplicate_slug_in_hierarchical_post_type() {
    11541154        register_post_type( 'handbook', array( 'hierarchical' => true ) );
    11551155
     
    11861186     * @ticket 29615
    11871187     */
    1188     function test_child_post_in_hierarchical_post_type_with_default_permalinks() {
     1188    public function test_child_post_in_hierarchical_post_type_with_default_permalinks() {
    11891189        register_post_type( 'handbook', array( 'hierarchical' => true ) );
    11901190
     
    12141214    }
    12151215
    1216     function test_title() {
     1216    public function test_title() {
    12171217        $title   = 'Tacos are Cool';
    12181218        $post_id = self::factory()->post->create(
Note: See TracChangeset for help on using the changeset viewer.