Changeset 47338 for branches/3.8/tests/phpunit/tests/rewrite.php
- Timestamp:
- 02/21/2020 01:05:39 PM (5 years ago)
- Location:
- branches/3.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8
- Property svn:mergeinfo changed
-
branches/3.8/tests/phpunit/tests/rewrite.php
r32150 r47338 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() { 22 $GLOBALS['wp_rewrite']->init(); 24 global $wp_rewrite; 25 $wp_rewrite->init(); 26 23 27 parent::tearDown(); 24 28 } … … 35 39 function test_url_to_postid_custom_post_type() { 36 40 delete_option( 'rewrite_rules' ); 37 41 38 42 $post_type = rand_str( 12 ); 39 43 register_post_type( $post_type, array( 'public' => true ) ); 40 44 41 45 $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 ); 46 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 47 48 _unregister_post_type( $post_type ); 45 49 } 46 50 47 51 function test_url_to_postid_hierarchical() { 48 52
Note: See TracChangeset
for help on using the changeset viewer.