Make WordPress Core


Ignore:
Timestamp:
08/04/2011 08:38:26 PM (15 years ago)
Author:
ryan
Message:

Pinking shears

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_canonical.php

    r365 r407  
    2020
    2121                $wp_rewrite->flush_rules();
    22                
     22
    2323        }
    2424
     
    7171                if ( isset($expected['url']) )
    7272                        $this->assertEquals( $expected['url'], $parsed_can_url['path'] . (!empty($parsed_can_url['query']) ? '?' . $parsed_can_url['query'] : ''), $ticket_ref );
    73        
    74                 if ( isset($expected['qv']) ) { 
     73
     74                if ( isset($expected['qv']) ) {
    7575
    7676                        // "make" that the request and check the query is correct
     
    7979                        // Are all query vars accounted for, And correct?
    8080                        global $wp;
    81        
     81
    8282                        $query_vars = array_diff($wp->query_vars, $wp->extra_query_vars);
    8383                        if ( !empty($parsed_can_url['query']) ) {
    8484                                parse_str($parsed_can_url['query'], $_qv);
    85        
     85
    8686                                // $_qv should not contain any elements which are set in $query_vars already (ie. $_GET vars should not be present in the Rewrite)
    8787                                $this->assertEquals( array(), array_intersect( $query_vars, $_qv ), 'Query vars are duplicated from the Rewrite into $_GET; ' . $ticket_ref );
    88                                
     88
    8989                                $query_vars = array_merge($query_vars, $_qv);
    9090                        }
    91        
     91
    9292                        $this->assertEquals( $expected['qv'], $query_vars );
    9393                } //isset $expected['qv']
     
    109109                                array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
    110110                                array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ),
    111                                
     111
    112112                                // Categories & Intersections with other vars
    113113                                array( '/category/uncategorized/?tag=post-formats', array( 'url' => '/category/uncategorized/?tag=post-formats', 'qv' => array('category_name' => 'uncategorized', 'tag' => 'post-formats') ) ),
    114114                                array( '/?category_name=cat-a,cat-b', array( 'url' => '/?category_name=cat-a,cat-b', 'qv' => array('category_name' => 'cat-a,cat-b' ) ) ),
    115                                
     115
    116116                                // Categories with Dates
    117117                                array( '/category/uncategorized/?paged=2&year=2008', array( 'url' => '/category/uncategorized/page/2/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2, 'year' => 2008) ), 17661 ),
     
    131131                                array( '/?page_id=144', '/parent-page/child-page-1/'),
    132132                                array( '/abo', '/about/' ),
    133                                
    134                                
     133
     134
    135135                                // Posts
    136136                                array( '?p=587', '/2008/06/02/post-format-test-audio/'),
     
    143143                                array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/'), // A Year the post is not in
    144144                                array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
    145                                
     145
    146146                                array( '/2008/09/03/images-test/3/', array( 'url' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => '/3' ) ) ), // page = /3 ?!
    147147                                array( '/2008/09/03/images-test/8/', '/2008/09/03/images-test/4/' ), // post with 4 pages
     
    153153                                array( '/2008/09/03/images-test/canola2/', '/2008/06/10/post-format-test-gallery/canola2/' ), // Image accessed via incorrect parent
    154154                                array( '/2008/06/10/post-format-test-gallery/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
    155                                
     155
    156156                                // Dates
    157157                                array( '/?m=2008', '/2008/' ),
     
    159159                                array( '/?m=20080905', '/2008/09/05/'),
    160160                                array( '/?m=2008095', '/2008/09/'), // Invalid date, /09/ or /09/05/ perhaps?
    161                                
     161
    162162                                array( '/2008/?day=05', '/2008/?day=05'), // no redirect
    163163                                array( '/2008/09/?day=05', '/2008/09/05/'),
    164164                                array( '/2008/?monthnum=9', '/2008/09/'),
    165                                
     165
    166166                                array( '/?year=2008', '/2008/'),
    167                                
     167
    168168                                // Authors
    169169                                array( '/?author=3', '/author/chip-bennett/' ),
    170170                                array( '/?author=3&year=2008', '/2008/?author=3'),
    171171                                array( '/author/chip-bennett/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
    172                                
     172
    173173                                // Todo: Endpoints (feeds, trackbacks, etc), More fuzzed mixed query variables, comment paging, Home page (Static)
    174174
Note: See TracChangeset for help on using the changeset viewer.