Changeset 34810 for trunk/tests/phpunit/tests/link.php
- Timestamp:
- 10/03/2015 08:54:11 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/link.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link.php
r34802 r34810 21 21 $old_req_uri = $_SERVER['REQUEST_URI']; 22 22 23 global $wp_rewrite; 24 $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/'); 25 $wp_rewrite->flush_rules(); 23 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 26 24 27 25 add_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) ); … … 36 34 37 35 function test_wp_get_shortlink() { 38 global $wp_rewrite;39 40 36 $post_id = $this->factory->post->create(); 41 37 $post_id2 = $this->factory->post->create(); … … 68 64 $this->assertEquals( '', wp_get_shortlink() ); 69 65 70 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 71 $wp_rewrite->flush_rules(); 66 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 72 67 73 68 // With a permalink structure set, get_permalink() will no longer match. … … 89 84 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 90 85 91 global $wp_rewrite; 92 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 93 $wp_rewrite->flush_rules(); 86 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 94 87 95 88 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) ); … … 106 99 $this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) ); 107 100 108 global $wp_rewrite; 109 $wp_rewrite->permalink_structure = ''; 110 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 111 $wp_rewrite->flush_rules(); 101 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 112 102 113 103 $this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) ); … … 397 387 */ 398 388 public function test_unattached_attachment_has_a_pretty_permalink() { 399 global $wp_rewrite; 400 $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/'); 401 $wp_rewrite->flush_rules(); 389 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 402 390 403 391 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', 0, array( … … 417 405 */ 418 406 public function test_attachment_attached_to_non_existent_post_type_has_a_pretty_permalink() { 419 global $wp_rewrite, $wp_post_types; 420 $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/'); 407 global $wp_post_types; 408 409 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 421 410 422 411 register_post_type( 'not_a_post_type', array( 'public' => true ) ); 423 412 424 $wp_rewrite->flush_rules();413 flush_rewrite_rules(); 425 414 426 415 $post_id = $this->factory->post->create( array( 'post_type' => 'not_a_post_type' ) );
Note: See TracChangeset
for help on using the changeset viewer.