diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index af073595c4..a673cc7566 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -19,16 +19,20 @@ class Tests_Canonical extends WP_UnitTestCase { var $term_ids; function setUp() { + global $wp_rewrite; + parent::setUp(); update_option( 'page_comments', true ); update_option( 'comments_per_page', 5 ); update_option( 'posts_per_page', 5 ); - update_option( 'permalink_structure', $this->structure ); + $wp_rewrite->init(); + $wp_rewrite->set_permalink_structure( $this->structure ); + create_initial_taxonomies(); - $GLOBALS['wp_rewrite']->init(); - flush_rewrite_rules(); + + $wp_rewrite->flush_rules(); $this->old_current_user = get_current_user_id(); $this->author_id = $this->factory->user->create( array( 'user_login' => 'canonical-author' ) ); diff --git a/tests/phpunit/tests/link.php b/tests/phpunit/tests/link.php index 9dd2750be9..3b363e1659 100644 --- a/tests/phpunit/tests/link.php +++ b/tests/phpunit/tests/link.php @@ -34,8 +34,9 @@ class Tests_Link extends WP_UnitTestCase { $post_id = $this->factory->post->create(); $post_id2 = $this->factory->post->create(); - $wp_rewrite->permalink_structure = ''; + $wp_rewrite->init(); $wp_rewrite->set_permalink_structure( '' ); + $wp_rewrite->flush_rules(); // Basic case $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );