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

    r46586 r47122  
    188188            $this->go_to( "{$url}trackback/" );
    189189
    190             // make sure the correct wp_query flags are set
     190            // Make sure the correct WP_Query flags are set.
    191191            $this->assertQueryTrue( 'is_page', 'is_singular', 'is_trackback' );
    192192
    193             // make sure the correct page was fetched
     193            // Make sure the correct page was fetched.
    194194            global $wp_query;
    195195            $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     
    197197    }
    198198
    199     //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
     199    // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
    200200    function test_page_feed() {
    201201        $page_ids   = array();
     
    227227            $this->go_to( "{$url}feed/" );
    228228
    229             // make sure the correct wp_query flags are set
     229            // Make sure the correct WP_Query flags are set.
    230230            $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' );
    231231
    232             // make sure the correct page was fetched
     232            // Make sure the correct page was fetched.
    233233            global $wp_query;
    234234            $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     
    264264            $this->go_to( "{$url}feed/" );
    265265
    266             // make sure the correct wp_query flags are set
     266            // Make sure the correct WP_Query flags are set.
    267267            $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' );
    268268
    269             // make sure the correct page was fetched
     269            // Make sure the correct page was fetched.
    270270            global $wp_query;
    271271            $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     
    304304            $this->go_to( "{$url}feed/atom/" );
    305305
    306             // make sure the correct wp_query flags are set
     306            // Make sure the correct WP_Query flags are set.
    307307            $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' );
    308308
    309             // make sure the correct page was fetched
     309            // Make sure the correct page was fetched.
    310310            global $wp_query;
    311311            $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     
    324324        $this->go_to( '/about/page/2/' );
    325325
    326         // make sure the correct wp_query flags are set
     326        // Make sure the correct WP_Query flags are set.
    327327        $this->assertQueryTrue( 'is_page', 'is_singular', 'is_paged' );
    328328
    329         // make sure the correct page was fetched
     329        // Make sure the correct page was fetched.
    330330        global $wp_query;
    331331        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     
    343343        $this->go_to( '/about/page2/' );
    344344
    345         // make sure the correct wp_query flags are set
     345        // Make sure the correct WP_Query flags are set.
    346346        $this->assertQueryTrue( 'is_page', 'is_singular', 'is_paged' );
    347347
    348         // make sure the correct page was fetched
     348        // Make sure the correct page was fetched.
    349349        global $wp_query;
    350350        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     
    367367        $this->assertQueryTrue( 'is_home', 'is_posts_page' );
    368368
    369         // make sure the correct page was fetched
     369        // Make sure the correct page was fetched.
    370370        global $wp_query;
    371371        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     
    375375    }
    376376
    377     // FIXME: no tests for these yet
     377    // FIXME: no tests for these yet:
    378378    // 'about/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
    379379    // 'about/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
     
    387387        $feeds = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    388388
    389         // long version
     389        // Long version.
    390390        foreach ( $feeds as $feed ) {
    391391            $this->go_to( "/feed/{$feed}/" );
     
    393393        }
    394394
    395         // short version
     395        // Short version.
    396396        foreach ( $feeds as $feed ) {
    397397            $this->go_to( "/{$feed}/" );
     
    426426        self::factory()->comment->create_post_comments( $post_id, 2 );
    427427
    428         // check the url as generated by get_post_comments_feed_link()
     428        // Check the URL as generated by get_post_comments_feed_link().
    429429        $this->go_to( get_post_comments_feed_link( $post_id ) );
    430430        $this->assertQueryTrue( 'is_feed', 'is_single', 'is_singular', 'is_comment_feed' );
    431431
    432         // check the long form
     432        // Check the long form.
    433433        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    434434        foreach ( $types as $type ) {
     
    437437        }
    438438
    439         // check the short form
     439        // Check the short form.
    440440        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    441441        foreach ( $types as $type ) {
     
    449449    // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
    450450    function test_search_feed() {
    451         // check the long form
     451        // Check the long form.
    452452        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    453453        foreach ( $types as $type ) {
     
    456456        }
    457457
    458         // check the short form
     458        // Сheck the short form.
    459459        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    460460        foreach ( $types as $type ) {
     
    496496        );
    497497
    498         // check the long form
     498        // Check the long form.
    499499        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    500500        foreach ( $types as $type ) {
     
    503503        }
    504504
    505         // check the short form
     505        // Check the short form.
    506506        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    507507        foreach ( $types as $type ) {
     
    540540            )
    541541        );
    542         // check the long form
     542        // Check the long form.
    543543        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    544544        foreach ( $types as $type ) {
     
    547547        }
    548548
    549         // check the short form
     549        // Check the short form.
    550550        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    551551        foreach ( $types as $type ) {
     
    594594    function test_author_feed() {
    595595        self::factory()->user->create( array( 'user_login' => 'user-a' ) );
    596         // check the long form
     596        // Check the long form.
    597597        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    598598        foreach ( $types as $type ) {
     
    601601        }
    602602
    603         // check the short form
     603        // Check the short form.
    604604        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    605605        foreach ( $types as $type ) {
     
    636636    function test_ymd_feed() {
    637637        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    638         // check the long form
     638        // Check the long form.
    639639        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    640640        foreach ( $types as $type ) {
     
    643643        }
    644644
    645         // check the short form
     645        // Check the short form.
    646646        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    647647        foreach ( $types as $type ) {
     
    670670    function test_ym_feed() {
    671671        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    672         // check the long form
     672        // Check the long form.
    673673        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    674674        foreach ( $types as $type ) {
     
    677677        }
    678678
    679         // check the short form
     679        // Check the short form.
    680680        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    681681        foreach ( $types as $type ) {
     
    704704    function test_y_feed() {
    705705        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    706         // check the long form
     706        // Check the long form.
    707707        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    708708        foreach ( $types as $type ) {
     
    711711        }
    712712
    713         // check the short form
     713        // Check the short form.
    714714        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    715715        foreach ( $types as $type ) {
     
    747747        $post_id   = self::factory()->post->create();
    748748        $permalink = get_permalink( $post_id );
    749 
     749        // Check the long form.
    750750        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    751751        foreach ( $types as $type ) {
     
    754754        }
    755755
    756         // check the short form
     756        // Check the short form.
    757757        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    758758        foreach ( $types as $type ) {
     
    772772        );
    773773        $this->go_to( get_permalink( $post_id ) . '2/' );
    774         // should is_paged be true also?
     774        // Should is_paged be true also?
    775775        $this->assertQueryTrue( 'is_single', 'is_singular' );
    776776
     
    902902     */
    903903    function test_is_single_with_parent() {
    904         // Use custom hierarchical post type
     904        // Use custom hierarchical post type.
    905905        $post_type = 'test_hierarchical';
    906906
     
    915915        );
    916916
    917         // Create parent and child posts
     917        // Create parent and child posts.
    918918        $parent_id = self::factory()->post->create(
    919919            array(
     
    931931        );
    932932
    933         // Tests
     933        // Tests.
    934934        $this->go_to( "/?p=$post_id&post_type=$post_type" );
    935935
     
    12001200        $this->go_to( "/?page_id=$post_id" );
    12011201
    1202         // override post ID to 0 temporarily for testing
     1202        // Override post ID to 0 temporarily for testing.
    12031203        $_id                           = $GLOBALS['wp_query']->post->ID;
    12041204        $GLOBALS['wp_query']->post->ID = 0;
     
    12111211        $this->assertFalse( $q->is_page( 'random-page-slug' ) );
    12121212
    1213         // revert $wp_query global change
     1213        // Revert $wp_query global change.
    12141214        $GLOBALS['wp_query']->post->ID = $_id;
    12151215    }
Note: See TracChangeset for help on using the changeset viewer.