Changeset 28966 for trunk/tests/phpunit/tests/rewrite.php
- Timestamp:
- 07/03/2014 01:42:57 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.