Changeset 34810 for trunk/tests/phpunit/tests/rewrite/numericSlugs.php
- Timestamp:
- 10/03/2015 08:54:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rewrite/numericSlugs.php
r34802 r34810 21 21 22 22 public function test_go_to_year_segment_collision_without_title() { 23 global $wp_rewrite, $wpdb; 24 $wp_rewrite->init(); 25 $wp_rewrite->set_permalink_structure( '/%postname%/' ); 26 $wp_rewrite->flush_rules(); 23 global $wpdb; 24 $this->set_permalink_structure( '/%postname%/' ); 27 25 28 26 $id = $this->factory->post->create( array( … … 51 49 52 50 public function test_url_to_postid_year_segment_collision_without_title() { 53 global $wp_rewrite, $wpdb; 54 $wp_rewrite->init(); 55 $wp_rewrite->set_permalink_structure( '/%postname%/' ); 56 $wp_rewrite->flush_rules(); 51 global $wpdb; 52 $this->set_permalink_structure( '/%postname%/' ); 57 53 58 54 $id = $this->factory->post->create( array( … … 79 75 80 76 public function test_go_to_year_segment_collision_with_title() { 81 global $wp_rewrite; 82 $wp_rewrite->init(); 83 $wp_rewrite->set_permalink_structure( '/%postname%/' ); 84 $wp_rewrite->flush_rules(); 77 $this->set_permalink_structure( '/%postname%/' ); 85 78 86 79 $id = $this->factory->post->create( array( … … 98 91 99 92 public function test_url_to_postid_year_segment_collision_with_title() { 100 global $wp_rewrite; 101 $wp_rewrite->init(); 102 $wp_rewrite->set_permalink_structure( '/%postname%/' ); 103 $wp_rewrite->flush_rules(); 93 $this->set_permalink_structure( '/%postname%/' ); 104 94 105 95 $id = $this->factory->post->create( array( … … 115 105 116 106 public function test_go_to_month_segment_collision_without_title() { 117 global $wp_rewrite; 118 $wp_rewrite->init(); 119 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 120 $wp_rewrite->flush_rules(); 107 $this->set_permalink_structure( '/%year%/%postname%/' ); 121 108 122 109 $id = $this->factory->post->create( array( … … 135 122 136 123 public function test_url_to_postid_month_segment_collision_without_title() { 137 global $wp_rewrite; 138 $wp_rewrite->init(); 139 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 140 $wp_rewrite->flush_rules(); 124 $this->set_permalink_structure( '/%year%/%postname%/' ); 141 125 142 126 $id = $this->factory->post->create( array( … … 153 137 154 138 public function test_go_to_month_segment_collision_without_title_no_leading_zero() { 155 global $wp_rewrite; 156 $wp_rewrite->init(); 157 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 158 $wp_rewrite->flush_rules(); 139 $this->set_permalink_structure( '/%year%/%postname%/' ); 159 140 160 141 $id = $this->factory->post->create( array( … … 173 154 174 155 public function test_url_to_postid_month_segment_collision_without_title_no_leading_zero() { 175 global $wp_rewrite; 176 $wp_rewrite->init(); 177 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 178 $wp_rewrite->flush_rules(); 156 $this->set_permalink_structure( '/%year%/%postname%/' ); 179 157 180 158 $id = $this->factory->post->create( array( … … 191 169 192 170 public function test_go_to_month_segment_collision_with_title() { 193 global $wp_rewrite; 194 $wp_rewrite->init(); 195 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 196 $wp_rewrite->flush_rules(); 171 $this->set_permalink_structure( '/%year%/%postname%/' ); 197 172 198 173 $id = $this->factory->post->create( array( … … 210 185 211 186 public function test_url_to_postid_month_segment_collision_with_title() { 212 global $wp_rewrite; 213 $wp_rewrite->init(); 214 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 215 $wp_rewrite->flush_rules(); 187 $this->set_permalink_structure( '/%year%/%postname%/' ); 216 188 217 189 $id = $this->factory->post->create( array( … … 227 199 228 200 public function test_go_to_month_segment_collision_with_title_no_leading_zero() { 229 global $wp_rewrite; 230 $wp_rewrite->init(); 231 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 232 $wp_rewrite->flush_rules(); 201 $this->set_permalink_structure( '/%year%/%postname%/' ); 233 202 234 203 $id = $this->factory->post->create( array( … … 246 215 247 216 public function test_url_to_postid_month_segment_collision_with_title_no_leading_zero() { 248 global $wp_rewrite; 249 $wp_rewrite->init(); 250 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 251 $wp_rewrite->flush_rules(); 217 $this->set_permalink_structure( '/%year%/%postname%/' ); 252 218 253 219 $id = $this->factory->post->create( array( … … 263 229 264 230 public function test_go_to_day_segment_collision_without_title() { 265 global $wp_rewrite; 266 $wp_rewrite->init(); 267 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 268 $wp_rewrite->flush_rules(); 231 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 269 232 270 233 $id = $this->factory->post->create( array( … … 283 246 284 247 public function test_url_to_postid_day_segment_collision_without_title() { 285 global $wp_rewrite; 286 $wp_rewrite->init(); 287 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 288 $wp_rewrite->flush_rules(); 248 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 289 249 290 250 $id = $this->factory->post->create( array( … … 301 261 302 262 public function test_go_to_day_segment_collision_with_title() { 303 global $wp_rewrite; 304 $wp_rewrite->init(); 305 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 306 $wp_rewrite->flush_rules(); 263 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 307 264 308 265 $id = $this->factory->post->create( array( … … 320 277 321 278 public function test_url_to_postid_day_segment_collision_with_title() { 322 global $wp_rewrite; 323 $wp_rewrite->init(); 324 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 325 $wp_rewrite->flush_rules(); 279 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 326 280 327 281 $id = $this->factory->post->create( array( … … 337 291 338 292 public function test_numeric_slug_permalink_conflicts_should_only_be_resolved_for_the_main_query() { 339 global $wp_rewrite; 340 $wp_rewrite->init(); 341 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 342 $wp_rewrite->flush_rules(); 293 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 343 294 344 295 $id = $this->factory->post->create( array( … … 361 312 362 313 public function test_month_slug_collision_should_resolve_to_date_archive_when_year_does_not_match_post_year() { 363 global $wp_rewrite; 364 $wp_rewrite->init(); 365 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 366 $wp_rewrite->flush_rules(); 314 $this->set_permalink_structure( '/%year%/%postname%/' ); 367 315 368 316 // Make sure a post is published in 2013/02, to avoid 404s. … … 392 340 393 341 public function test_day_slug_collision_should_resolve_to_date_archive_when_monthnum_does_not_match_post_month() { 394 global $wp_rewrite; 395 $wp_rewrite->init(); 396 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 397 $wp_rewrite->flush_rules(); 342 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 398 343 399 344 // Make sure a post is published on 2015/01/01, to avoid 404s. … … 423 368 424 369 public function test_date_slug_collision_should_distinguish_valid_pagination_from_date() { 425 global $wp_rewrite; 426 $wp_rewrite->init(); 427 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 428 $wp_rewrite->flush_rules(); 370 $this->set_permalink_structure( '/%year%/%postname%/' ); 429 371 430 372 $id = $this->factory->post->create( array( … … 442 384 443 385 public function test_date_slug_collision_should_distinguish_too_high_pagination_from_date() { 444 global $wp_rewrite; 445 $wp_rewrite->init(); 446 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 447 $wp_rewrite->flush_rules(); 386 $this->set_permalink_structure( '/%year%/%postname%/' ); 448 387 449 388 $id = $this->factory->post->create( array( … … 461 400 462 401 public function test_date_slug_collision_should_not_require_pagination_query_var() { 463 global $wp_rewrite; 464 $wp_rewrite->init(); 465 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 466 $wp_rewrite->flush_rules(); 402 $this->set_permalink_structure( '/%year%/%postname%/' ); 467 403 468 404 $id = $this->factory->post->create( array( … … 481 417 482 418 public function test_date_slug_collision_should_be_ignored_when_pagination_var_is_present_but_post_does_not_have_multiple_pages() { 483 global $wp_rewrite; 484 $wp_rewrite->init(); 485 $wp_rewrite->set_permalink_structure( '/%year%/%postname%/' ); 486 $wp_rewrite->flush_rules(); 419 $this->set_permalink_structure( '/%year%/%postname%/' ); 487 420 488 421 $id = $this->factory->post->create( array(
Note: See TracChangeset
for help on using the changeset viewer.