diff --git a/tests/phpunit/includes/testcase-canonical.php b/tests/phpunit/includes/testcase-canonical.php index 64d7c22287..e0b93c8511 100644 --- a/tests/phpunit/includes/testcase-canonical.php +++ b/tests/phpunit/includes/testcase-canonical.php @@ -30,13 +30,8 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase { update_option( 'comments_per_page', 5 ); update_option( 'posts_per_page', 5 ); - global $wp_rewrite; - $wp_rewrite->init(); - $wp_rewrite->set_permalink_structure( $this->structure ); - + $this->set_permalink_structure( $this->structure ); create_initial_taxonomies(); - - $wp_rewrite->flush_rules(); } /** diff --git a/tests/phpunit/tests/canonical/https.php b/tests/phpunit/tests/canonical/https.php index 88fa7f4ec7..c6b59bdb34 100644 --- a/tests/phpunit/tests/canonical/https.php +++ b/tests/phpunit/tests/canonical/https.php @@ -7,14 +7,10 @@ */ class Tests_Canonical_HTTPS extends WP_Canonical_UnitTestCase { function setUp() { - global $wp_rewrite; - parent::setUp(); - $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); + $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); create_initial_taxonomies(); - $wp_rewrite->flush_rules(); - $wp_rewrite->init(); $this->http = set_url_scheme( home_url( 'sample-page/' ), 'http' ); $this->https = set_url_scheme( home_url( 'sample-page/' ), 'https' ); diff --git a/tests/phpunit/tests/query.php b/tests/phpunit/tests/query.php index 04e6d092f2..777fbe7f82 100644 --- a/tests/phpunit/tests/query.php +++ b/tests/phpunit/tests/query.php @@ -5,8 +5,8 @@ class Tests_Query extends WP_UnitTestCase { function setUp() { parent::setUp(); - create_initial_taxonomies(); $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); + create_initial_taxonomies(); } /** diff --git a/tests/phpunit/tests/query/verboseRewriteRules.php b/tests/phpunit/tests/query/verboseRewriteRules.php index 90d29b253e..5414a51a9a 100644 --- a/tests/phpunit/tests/query/verboseRewriteRules.php +++ b/tests/phpunit/tests/query/verboseRewriteRules.php @@ -10,8 +10,7 @@ class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals { function setUp() { parent::setUp(); - create_initial_taxonomies(); - $this->set_permalink_structure( '/%category%/%year%/%postname%/' ); + create_initial_taxonomies(); } } diff --git a/tests/phpunit/tests/rewrite.php b/tests/phpunit/tests/rewrite.php index 517124f9fd..dfa9749821 100644 --- a/tests/phpunit/tests/rewrite.php +++ b/tests/phpunit/tests/rewrite.php @@ -11,9 +11,8 @@ class Tests_Rewrite extends WP_UnitTestCase { function setUp() { parent::setUp(); - create_initial_taxonomies(); - $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); + create_initial_taxonomies(); $this->home_url = get_option( 'home' ); } @@ -348,8 +347,6 @@ class Tests_Rewrite extends WP_UnitTestCase { $post_id = self::factory()->post->create( array( 'post_title' => get_post( $page_id )->post_title ) ); $this->assertEquals( $post_id, url_to_postid( get_permalink( $post_id ) ) ); - - $this->set_permalink_structure(); } /** @@ -385,15 +382,13 @@ class Tests_Rewrite extends WP_UnitTestCase { $this->assertTrue( is_single() ); $this->assertFalse( is_404() ); - - $this->set_permalink_structure(); } /** * @ticket 29107 */ public function test_flush_rules_does_not_delete_option() { - $this->set_permalink_structure(); + $this->set_permalink_structure( '' ); $rewrite_rules = get_option( 'rewrite_rules' ); $this->assertSame( '', $rewrite_rules );