Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 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/post/query.php

    r46586 r47122  
    9696        );
    9797
    98         // Fourth post added in filter
     98        // Fourth post added in filter.
    9999        $this->assertEquals( 4, count( $query->posts ) );
    100100        $this->assertEquals( 4, $query->post_count );
     
    102102        foreach ( $query->posts as $post ) {
    103103
    104             // posts are WP_Post objects
     104            // Posts are WP_Post objects.
    105105            $this->assertTrue( is_a( $post, 'WP_Post' ) );
    106106
    107             // filters are raw
     107            // Filters are raw.
    108108            $this->assertEquals( 'raw', $post->filter );
    109109
    110             // custom data added in the_posts filter is preserved
     110            // Custom data added in the_posts filter is preserved.
    111111            $this->assertEquals( array( $post->ID, 'custom data' ), $post->custom_data );
    112112        }
     
    409409     */
    410410    function test_orderby() {
    411         // 'rand' is a valid value
     411        // 'rand' is a valid value.
    412412        $q = new WP_Query( array( 'orderby' => 'rand' ) );
    413413        $this->assertContains( 'ORDER BY RAND()', $q->request );
     
    415415        $this->assertNotContains( 'DESC', $q->request );
    416416
    417         // This isn't allowed
     417        // This isn't allowed.
    418418        $q2 = new WP_Query( array( 'order' => 'rand' ) );
    419419        $this->assertContains( 'ORDER BY', $q2->request );
     
    421421        $this->assertContains( 'DESC', $q2->request );
    422422
    423         // 'none' is a valid value
     423        // 'none' is a valid value.
    424424        $q3 = new WP_Query( array( 'orderby' => 'none' ) );
    425425        $this->assertNotContains( 'ORDER BY', $q3->request );
     
    427427        $this->assertNotContains( 'ASC', $q3->request );
    428428
    429         // false is a valid value
     429        // False is a valid value.
    430430        $q4 = new WP_Query( array( 'orderby' => false ) );
    431431        $this->assertNotContains( 'ORDER BY', $q4->request );
     
    433433        $this->assertNotContains( 'ASC', $q4->request );
    434434
    435         // empty array() is a valid value
     435        // Empty array() is a valid value.
    436436        $q5 = new WP_Query( array( 'orderby' => array() ) );
    437437        $this->assertNotContains( 'ORDER BY', $q5->request );
     
    567567        $this->post_id = self::factory()->post->create();
    568568
    569         // Prevent the DB query
     569        // Prevent the DB query.
    570570        add_filter( 'posts_request', '__return_empty_string' );
    571571        add_filter( 'found_posts_query', '__return_empty_string' );
    572572
    573         // Add the post and found_posts
     573        // Add the post and found_posts.
    574574        add_filter( 'the_posts', array( $this, 'filter_the_posts' ) );
    575575        add_filter( 'found_posts', array( $this, 'filter_found_posts' ) );
     
    691691
    692692    public function set_found_posts_provider() {
    693         // count return 0 for null, but 1 for other data you may not expect
     693        // Count return 0 for null, but 1 for other data you may not expect.
    694694        return array(
    695695            array( null, 0 ),
Note: See TracChangeset for help on using the changeset viewer.