Changeset 28966
- Timestamp:
- 07/03/2014 01:42:57 AM (11 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/canonical.php
r28964 r28966 85 85 86 86 function tearDown() { 87 global $wp_rewrite; 87 88 parent::tearDown(); 88 89 wp_set_current_user( $this->old_current_user ); 89 90 90 $ GLOBALS['wp_rewrite']->init();91 $wp_rewrite->init(); 91 92 } 92 93 -
trunk/tests/phpunit/tests/canonical/pageOnFront.php
r25002 r28966 16 16 update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) ); 17 17 $wp_rewrite->init(); 18 flush_rewrite_rules(); 18 $wp_rewrite->flush_rules(); 19 } 20 21 function tearDown() { 22 global $wp_rewrite; 23 parent::tearDown(); 24 $wp_rewrite->init(); 19 25 } 20 26 -
trunk/tests/phpunit/tests/link.php
r28964 r28966 4 4 */ 5 5 class Tests_Link extends WP_UnitTestCase { 6 7 function tearDown() { 8 global $wp_rewrite; 9 parent::tearDown(); 10 $wp_rewrite->init(); 11 } 6 12 7 13 function _get_pagenum_link_cb( $url ) { … … 66 72 $this->assertEquals( '', wp_get_shortlink() ); 67 73 68 $wp_rewrite->permalink_structure = '';69 74 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 70 75 $wp_rewrite->flush_rules(); … … 79 84 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) ); 80 85 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() ); 81 82 $wp_rewrite->set_permalink_structure( '' );83 $wp_rewrite->flush_rules();84 86 } 85 87 … … 92 94 93 95 global $wp_rewrite; 94 $wp_rewrite->permalink_structure = '';95 96 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 96 97 $wp_rewrite->flush_rules(); 97 98 98 99 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 99 100 $wp_rewrite->set_permalink_structure( '' );101 $wp_rewrite->flush_rules();102 100 } 103 101 … … 118 116 119 117 $this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) ); 120 121 $wp_rewrite->set_permalink_structure( '' );122 $wp_rewrite->flush_rules();123 118 } 124 119 -
trunk/tests/phpunit/tests/query/conditionals.php
r27187 r28966 24 24 25 25 global $wp_rewrite; 26 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' ); 26 27 $wp_rewrite->init(); 28 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 29 27 30 create_initial_taxonomies(); 28 $GLOBALS['wp_rewrite']->init(); 29 flush_rewrite_rules();31 32 $wp_rewrite->flush_rules(); 30 33 } 31 34 32 35 function tearDown() { 36 global $wp_rewrite; 33 37 parent::tearDown(); 34 $ GLOBALS['wp_rewrite']->init();38 $wp_rewrite->init(); 35 39 } 36 40 -
trunk/tests/phpunit/tests/query/taxQuery.php
r26875 r28966 23 23 24 24 function setUp() { 25 global $wp_rewrite; 25 26 parent::setUp(); 26 27 27 28 set_current_screen( 'front' ); 28 29 29 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );30 31 30 $GLOBALS['wp_the_query'] = new WP_Query(); 32 31 $GLOBALS['wp_query'] = $GLOBALS['wp_the_query']; 32 33 $wp_rewrite->init(); 34 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 33 35 34 36 create_initial_taxonomies(); 35 37 register_taxonomy( 'testtax', 'post', array( 'public' => true ) ); 36 38 37 $GLOBALS['wp_rewrite']->init(); 38 flush_rewrite_rules(); 39 $wp_rewrite->flush_rules(); 39 40 40 41 $this->tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) ); … … 57 58 58 59 function tearDown() { 60 global $wp_rewrite; 59 61 parent::tearDown(); 60 62 61 63 _unregister_taxonomy( 'testtax' ); 64 65 $wp_rewrite->init(); 62 66 63 67 remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) ); -
trunk/tests/phpunit/tests/query/verboseRewriteRules.php
r25002 r28966 9 9 class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals { 10 10 function setUp() { 11 global $wp_rewrite; 12 11 13 parent::setUp(); 12 global $wp_rewrite; 13 update_option( 'permalink_structure', '/%category%/%year%/%postname%/' ); 14 15 $wp_rewrite->init(); 16 $wp_rewrite->set_permalink_structure( '/%category%/%year%/%postname%/' ); 17 14 18 create_initial_taxonomies(); 15 $GLOBALS['wp_rewrite']->init(); 16 flush_rewrite_rules();19 20 $wp_rewrite->flush_rules(); 17 21 } 18 22 } -
trunk/tests/phpunit/tests/rewrite.php
r25659 r28966 9 9 10 10 function setUp() { 11 global $wp_rewrite; 11 12 parent::setUp(); 12 13 13 14 // Need rewrite rules in place to use url_to_postid 14 global $wp_rewrite; 15 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' ); 15 $wp_rewrite->init(); 16 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 17 16 18 create_initial_taxonomies(); 17 $GLOBALS['wp_rewrite']->init(); 18 flush_rewrite_rules();19 20 $wp_rewrite->flush_rules(); 19 21 } 20 22 21 23 function tearDown() { 24 global $wp_rewrite; 22 25 parent::tearDown(); 23 $ GLOBALS['wp_rewrite']->init();26 $wp_rewrite->init(); 24 27 } 25 28 … … 35 38 function test_url_to_postid_custom_post_type() { 36 39 delete_option( 'rewrite_rules' ); 37 40 38 41 $post_type = rand_str( 12 ); 39 42 register_post_type( $post_type, array( 'public' => true ) ); 40 43 41 44 $id = $this->factory->post->create( array( 'post_type' => $post_type ) ); 42 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 43 44 _unregister_post_type( $post_type ); 45 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 46 47 _unregister_post_type( $post_type ); 45 48 } 46 49 47 50 function test_url_to_postid_hierarchical() { 48 51
Note: See TracChangeset
for help on using the changeset viewer.