Changeset 407 in tests for wp-testcase/test_includes_canonical.php
- Timestamp:
- 08/04/2011 08:38:26 PM (15 years ago)
- File:
-
- 1 edited
-
wp-testcase/test_includes_canonical.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_includes_canonical.php
r365 r407 20 20 21 21 $wp_rewrite->flush_rules(); 22 22 23 23 } 24 24 … … 71 71 if ( isset($expected['url']) ) 72 72 $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']) ) { 75 75 76 76 // "make" that the request and check the query is correct … … 79 79 // Are all query vars accounted for, And correct? 80 80 global $wp; 81 81 82 82 $query_vars = array_diff($wp->query_vars, $wp->extra_query_vars); 83 83 if ( !empty($parsed_can_url['query']) ) { 84 84 parse_str($parsed_can_url['query'], $_qv); 85 85 86 86 // $_qv should not contain any elements which are set in $query_vars already (ie. $_GET vars should not be present in the Rewrite) 87 87 $this->assertEquals( array(), array_intersect( $query_vars, $_qv ), 'Query vars are duplicated from the Rewrite into $_GET; ' . $ticket_ref ); 88 88 89 89 $query_vars = array_merge($query_vars, $_qv); 90 90 } 91 91 92 92 $this->assertEquals( $expected['qv'], $query_vars ); 93 93 } //isset $expected['qv'] … … 109 109 array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ), 110 110 array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ), 111 111 112 112 // Categories & Intersections with other vars 113 113 array( '/category/uncategorized/?tag=post-formats', array( 'url' => '/category/uncategorized/?tag=post-formats', 'qv' => array('category_name' => 'uncategorized', 'tag' => 'post-formats') ) ), 114 114 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 116 116 // Categories with Dates 117 117 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 ), … … 131 131 array( '/?page_id=144', '/parent-page/child-page-1/'), 132 132 array( '/abo', '/about/' ), 133 134 133 134 135 135 // Posts 136 136 array( '?p=587', '/2008/06/02/post-format-test-audio/'), … … 143 143 array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/'), // A Year the post is not in 144 144 array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'), 145 145 146 146 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 ?! 147 147 array( '/2008/09/03/images-test/8/', '/2008/09/03/images-test/4/' ), // post with 4 pages … … 153 153 array( '/2008/09/03/images-test/canola2/', '/2008/06/10/post-format-test-gallery/canola2/' ), // Image accessed via incorrect parent 154 154 array( '/2008/06/10/post-format-test-gallery/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ), 155 155 156 156 // Dates 157 157 array( '/?m=2008', '/2008/' ), … … 159 159 array( '/?m=20080905', '/2008/09/05/'), 160 160 array( '/?m=2008095', '/2008/09/'), // Invalid date, /09/ or /09/05/ perhaps? 161 161 162 162 array( '/2008/?day=05', '/2008/?day=05'), // no redirect 163 163 array( '/2008/09/?day=05', '/2008/09/05/'), 164 164 array( '/2008/?monthnum=9', '/2008/09/'), 165 165 166 166 array( '/?year=2008', '/2008/'), 167 167 168 168 // Authors 169 169 array( '/?author=3', '/author/chip-bennett/' ), 170 170 array( '/?author=3&year=2008', '/2008/?author=3'), 171 171 array( '/author/chip-bennett/?year=2008', '/2008/?author=3'), //Either or, see previous testcase. 172 172 173 173 // Todo: Endpoints (feeds, trackbacks, etc), More fuzzed mixed query variables, comment paging, Home page (Static) 174 174
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)