Make WordPress Core


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

    r46586 r47122  
    3434
    3535    function data_canonical() {
    36         /* Data format:
     36        /*
     37         * Data format:
    3738         * [0]: Test URL.
    38          * [1]: expected results: Any of the following can be used
     39         * [1]: Expected results: Any of the following can be used.
    3940         *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
    4041         *      array( expected query vars to be set, same as 'qv' above )
     
    4445         */
    4546
    46         // Please Note: A few test cases are commented out below, Look at the test case following it, in most cases it's simply showing 2 options for the "proper" redirect.
     47        // Please Note: A few test cases are commented out below, look at the test case following it.
     48        // In most cases it's simply showing 2 options for the "proper" redirect.
    4749        return array(
    48             // Categories
    49 
     50            // Categories.
    5051            array( '?cat=%d', array( 'url' => '/category/parent/' ), 15256 ),
    5152            array( '?cat=%d', array( 'url' => '/category/parent/child-1/' ), 15256 ),
    52             array( '?cat=%d', array( 'url' => '/category/parent/child-1/child-2/' ) ), // no children
     53            array( '?cat=%d', array( 'url' => '/category/parent/child-1/child-2/' ) ), // No children.
    5354            array(
    5455                '/category/uncategorized/',
     
    9091            ),
    9192
    92             // Categories & Intersections with other vars
     93            // Categories & intersections with other vars.
    9394            array(
    9495                '/category/uncategorized/?tag=post-formats',
     
    109110            ),
    110111
    111             // Taxonomies with extra Query Vars
    112             array( '/category/cat-a/page/1/?test=one%20two', '/category/cat-a/?test=one%20two', 18086 ), // Extra query vars should stay encoded
    113 
    114             // Categories with Dates
     112            // Taxonomies with extra query vars.
     113            array( '/category/cat-a/page/1/?test=one%20two', '/category/cat-a/?test=one%20two', 18086 ), // Extra query vars should stay encoded.
     114
     115            // Categories with dates.
    115116            array(
    116117                '/2008/04/?cat=1',
     
    125126                17661,
    126127            ),
    127             //          array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ) ),
    128 
    129                             // Pages
    130                             array( '/child-page-1/', '/parent-page/child-page-1/' ),
     128            /*
     129            array(
     130                '/2008/?category_name=cat-a',
     131                    array(
     132                        'url' => '/2008/?category_name=cat-a',
     133                        'qv'  => array(
     134                            'category_name' => 'cat-a',
     135                            'year'          => '2008'
     136                        )
     137                    )
     138            ),
     139            */
     140
     141            // Pages.
     142            array( '/child-page-1/', '/parent-page/child-page-1/' ),
    131143            array( '/?page_id=144', '/parent-page/child-page-1/' ),
    132144            array( '/abo', '/about/' ),
     
    134146            array( '/parent/child2/grandchild/', '/parent/child2/grandchild/' ),
    135147
    136             // Posts
     148            // Posts.
    137149            array( '?p=587', '/2008/06/02/post-format-test-audio/' ),
    138150            array( '/?name=images-test', '/2008/09/03/images-test/' ),
    139             // Incomplete slug should resolve and remove the ?name= parameter
     151            // Incomplete slug should resolve and remove the ?name= parameter.
    140152            array( '/?name=images-te', '/2008/09/03/images-test/', 20374 ),
    141             // Page slug should resolve to post slug and remove the ?pagename= parameter
     153            // Page slug should resolve to post slug and remove the ?pagename= parameter.
    142154            array( '/?pagename=images-test', '/2008/09/03/images-test/', 20374 ),
    143155
     
    145157            array( '/2008/06/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ),
    146158            array( '/2008/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ),
    147             array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ), // A Year the post is not in
     159            array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ), // A year the post is not in.
    148160            array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ),
    149161
     
    164176            array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
    165177
    166             // Comments
     178            // Comments.
    167179            array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ),
    168180
    169             // Attachments
     181            // Attachments.
    170182            array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
    171183            array( '/2008/06/10/post-format-test-gallery/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
    172184
    173             // Dates
     185            // Dates.
    174186            array( '/?m=2008', '/2008/' ),
    175187            array( '/?m=200809', '/2008/09/' ),
    176188            array( '/?m=20080905', '/2008/09/05/' ),
    177189
    178             array( '/2008/?day=05', '/2008/?day=05' ), // no redirect
     190            array( '/2008/?day=05', '/2008/?day=05' ), // No redirect.
    179191            array( '/2008/09/?day=05', '/2008/09/05/' ),
    180192            array( '/2008/?monthnum=9', '/2008/09/' ),
     
    185197            array( '/2012/11/51/', '/2012/11/', 0, array( 'WP_Date_Query' ) ),
    186198
    187             // Authors
     199            // Authors.
    188200            array( '/?author=%d', '/author/canonical-author/' ),
    189             //          array( '/?author=%d&year=2008', '/2008/?author=3'),
    190             //          array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
    191 
    192                 // Feeds
    193                 array( '/?feed=atom', '/feed/atom/' ),
     201            // array( '/?author=%d&year=2008', '/2008/?author=3'),
     202            // array( '/author/canonical-author/?year=2008', '/2008/?author=3'), // Either or, see previous testcase.
     203
     204            // Feeds.
     205            array( '/?feed=atom', '/feed/atom/' ),
    194206            array( '/?feed=rss2', '/feed/' ),
    195207            array( '/?feed=comments-rss2', '/comments/feed/' ),
    196208            array( '/?feed=comments-atom', '/comments/feed/atom/' ),
    197209
    198             // Feeds (per-post)
     210            // Feeds (per-post).
    199211            array( '/2008/03/03/comment-test/?feed=comments-atom', '/2008/03/03/comment-test/feed/atom/' ),
    200212            array( '/?p=149&feed=comments-atom', '/2008/03/03/comment-test/feed/atom/' ),
    201213
    202             // Index
     214            // Index.
    203215            array( '/?paged=1', '/' ),
    204216            array( '/page/1/', '/' ),
     
    207219            array( '/page2/', '/page/2/' ),
    208220
    209             // Misc
     221            // Misc.
    210222            array( '/2008%20', '/2008' ),
    211223            array( '//2008////', '/2008/' ),
    212224
    213             // Todo: Endpoints (feeds, trackbacks, etc), More fuzzed mixed query variables, comment paging, Home page (Static)
     225            // @todo Endpoints (feeds, trackbacks, etc). More fuzzed mixed query variables, comment paging, Home page (static).
    214226        );
    215227    }
Note: See TracChangeset for help on using the changeset viewer.