WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/results.php

    r46586 r47122  
    305305        $posts = $this->q->query( '' );
    306306
    307         // the output should be the most recent 10 posts as listed here
     307        // The output should be the most recent 10 posts as listed here.
    308308        $expected = array(
    309309            0 => 'tags-a-and-c',
     
    325325        $posts = $this->q->query( 'tag=tag-a' );
    326326
    327         // there are 4 posts with Tag A
     327        // There are 4 posts with Tag A.
    328328        $this->assertCount( 4, $posts );
    329329        $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
     
    336336        $posts = $this->q->query( 'tag=tag-b' );
    337337
    338         // there are 4 posts with Tag A
     338        // There are 4 posts with Tag A.
    339339        $this->assertCount( 4, $posts );
    340340        $this->assertEquals( 'tags-b-and-c', $posts[0]->post_name );
     
    350350        $posts = $this->q->query( 'tag=tag-נ' );
    351351
    352         // there is 1 post with Tag נ
     352        // There is 1 post with Tag נ.
    353353        $this->assertCount( 1, $posts );
    354354        $this->assertEquals( 'tag-%d7%a0', $posts[0]->post_name );
     
    359359        $posts = $this->q->query( 'tag_id=' . $tag['term_id'] );
    360360
    361         // there are 4 posts with Tag A
     361        // There are 4 posts with Tag A.
    362362        $this->assertCount( 4, $posts );
    363363        $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
     
    370370        $posts = $this->q->query( 'tag_slug__in[]=tag-b&tag_slug__in[]=tag-c' );
    371371
    372         // there are 4 posts with either Tag B or Tag C
     372        // There are 4 posts with either Tag B or Tag C.
    373373        $this->assertCount( 6, $posts );
    374374        $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
     
    386386        $posts = $this->q->query( 'tag__in[]=' . $tag_a['term_id'] . '&tag__in[]=' . $tag_b['term_id'] );
    387387
    388         // there are 6 posts with either Tag A or Tag B
     388        // There are 6 posts with either Tag A or Tag B.
    389389        $this->assertCount( 6, $posts );
    390390        $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
     
    400400        $posts = $this->q->query( 'tag__not_in[]=' . $tag_a['term_id'] );
    401401
    402         // the most recent 10 posts with Tag A excluded
    403         // (note the different between this and test_query_default)
     402        // The most recent 10 posts with Tag A excluded
     403        // (note the different between this and test_query_default).
    404404        $expected = array(
    405405            0 => 'tags-b-and-c',
     
    423423        $posts = $this->q->query( 'tag__in[]=' . $tag_a['term_id'] . '&tag__not_in[]=' . $tag_b['term_id'] );
    424424
    425         // there are 4 posts with Tag A, only 2 when we exclude Tag B
     425        // There are 4 posts with Tag A, only 2 when we exclude Tag B.
    426426        $this->assertCount( 2, $posts );
    427427        $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
     
    434434        $posts = $this->q->query( 'category_name=cat-a' );
    435435
    436         // there are 4 posts with Cat A, we'll check for them by name
     436        // There are 4 posts with Cat A, we'll check for them by name.
    437437        $this->assertCount( 4, $posts );
    438438        $this->assertEquals( 'cat-a', $posts[0]->post_name );
     
    446446        $posts = $this->q->query( "cat=$cat" );
    447447
    448         // there are 4 posts with Cat B
     448        // There are 4 posts with Cat B.
    449449        $this->assertCount( 4, $posts );
    450450        $this->assertEquals( 'cat-b', $posts[0]->post_name );
     
    529529     */
    530530    function test_query_post_parent__in() {
    531         // Query for first parent's children
     531        // Query for first parent's children.
    532532        $posts = $this->q->query(
    533533            array(
     
    546546        );
    547547
    548         // Second parent's children
     548        // Second parent's children.
    549549        $posts = $this->q->query(
    550550            array(
     
    563563        );
    564564
    565         // Both first and second parent's children
     565        // Both first and second parent's children.
    566566        $posts = $this->q->query(
    567567            array(
     
    582582        );
    583583
    584         // Third parent's children
     584        // Third parent's children.
    585585        $posts = $this->q->query(
    586586            array(
     
    630630        );
    631631
    632         // order=desc does not influence the order of returned results (returns same order as order=asc)
     632        // 'order=desc' does not influence the order of returned results (returns same order as 'order=asc').
    633633        $this->assertEquals( $expected_returned_array, wp_list_pluck( $posts, 'post_title' ) );
    634634    }
     
    649649        );
    650650
    651         // Expect post ids in the same order as post__in array when no 'order' param is passed in
     651        // Expect post IDs in the same order as post__in array when no 'order' param is passed in.
    652652        $this->assertSame( $expected_returned_array, $q->posts );
    653653    }
     
    669669        );
    670670
    671         // Expect post ids in the same order as post__in array when order=asc is passed in
     671        // Expect post IDs in the same order as post__in array when order=asc is passed in.
    672672        $this->assertSame( $expected_returned_array, $q->posts );
    673673    }
     
    689689        );
    690690
    691         // Note that results are returned in the order specified in the post__in array
    692         // Order=desc does not have an effect on the order of returned results
     691        // Note that results are returned in the order specified in the post__in array.
     692        // 'order=desc' does not influence the order of returned results.
    693693        $this->assertSame( $expected_returned_array, $q->posts );
    694694    }
     
    725725        );
    726726
    727         // order=desc does not influence the order of returned results (returns same order as order=asc)
     727        // 'order=desc' does not influence the order of returned results (returns same order as 'order=asc').
    728728        $this->assertSame( $post_name__in_array, array_unique( wp_list_pluck( $q->posts, 'post_title' ) ) );
    729729    }
Note: See TracChangeset for help on using the changeset viewer.