Changeset 47122 for trunk/tests/phpunit/tests/canonical.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/canonical.php
r46586 r47122 34 34 35 35 function data_canonical() { 36 /* Data format: 36 /* 37 * Data format: 37 38 * [0]: Test URL. 38 * [1]: expected results: Any of the following can be used39 * [1]: Expected results: Any of the following can be used. 39 40 * array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET ); 40 41 * array( expected query vars to be set, same as 'qv' above ) … … 44 45 */ 45 46 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. 47 49 return array( 48 // Categories 49 50 // Categories. 50 51 array( '?cat=%d', array( 'url' => '/category/parent/' ), 15256 ), 51 52 array( '?cat=%d', array( 'url' => '/category/parent/child-1/' ), 15256 ), 52 array( '?cat=%d', array( 'url' => '/category/parent/child-1/child-2/' ) ), // no children53 array( '?cat=%d', array( 'url' => '/category/parent/child-1/child-2/' ) ), // No children. 53 54 array( 54 55 '/category/uncategorized/', … … 90 91 ), 91 92 92 // Categories & Intersections with other vars93 // Categories & intersections with other vars. 93 94 array( 94 95 '/category/uncategorized/?tag=post-formats', … … 109 110 ), 110 111 111 // Taxonomies with extra Query Vars112 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 Dates112 // 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. 115 116 array( 116 117 '/2008/04/?cat=1', … … 125 126 17661, 126 127 ), 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/' ), 131 143 array( '/?page_id=144', '/parent-page/child-page-1/' ), 132 144 array( '/abo', '/about/' ), … … 134 146 array( '/parent/child2/grandchild/', '/parent/child2/grandchild/' ), 135 147 136 // Posts 148 // Posts. 137 149 array( '?p=587', '/2008/06/02/post-format-test-audio/' ), 138 150 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. 140 152 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. 142 154 array( '/?pagename=images-test', '/2008/09/03/images-test/', 20374 ), 143 155 … … 145 157 array( '/2008/06/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ), 146 158 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 in159 array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ), // A year the post is not in. 148 160 array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ), 149 161 … … 164 176 array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ), 165 177 166 // Comments 178 // Comments. 167 179 array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ), 168 180 169 // Attachments 181 // Attachments. 170 182 array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ), 171 183 array( '/2008/06/10/post-format-test-gallery/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ), 172 184 173 // Dates 185 // Dates. 174 186 array( '/?m=2008', '/2008/' ), 175 187 array( '/?m=200809', '/2008/09/' ), 176 188 array( '/?m=20080905', '/2008/09/05/' ), 177 189 178 array( '/2008/?day=05', '/2008/?day=05' ), // no redirect190 array( '/2008/?day=05', '/2008/?day=05' ), // No redirect. 179 191 array( '/2008/09/?day=05', '/2008/09/05/' ), 180 192 array( '/2008/?monthnum=9', '/2008/09/' ), … … 185 197 array( '/2012/11/51/', '/2012/11/', 0, array( 'WP_Date_Query' ) ), 186 198 187 // Authors 199 // Authors. 188 200 array( '/?author=%d', '/author/canonical-author/' ), 189 // 190 // array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.191 192 // Feeds193 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/' ), 194 206 array( '/?feed=rss2', '/feed/' ), 195 207 array( '/?feed=comments-rss2', '/comments/feed/' ), 196 208 array( '/?feed=comments-atom', '/comments/feed/atom/' ), 197 209 198 // Feeds (per-post) 210 // Feeds (per-post). 199 211 array( '/2008/03/03/comment-test/?feed=comments-atom', '/2008/03/03/comment-test/feed/atom/' ), 200 212 array( '/?p=149&feed=comments-atom', '/2008/03/03/comment-test/feed/atom/' ), 201 213 202 // Index 214 // Index. 203 215 array( '/?paged=1', '/' ), 204 216 array( '/page/1/', '/' ), … … 207 219 array( '/page2/', '/page/2/' ), 208 220 209 // Misc 221 // Misc. 210 222 array( '/2008%20', '/2008' ), 211 223 array( '//2008////', '/2008/' ), 212 224 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). 214 226 ); 215 227 }
Note: See TracChangeset
for help on using the changeset viewer.