diff --git a/tests/phpunit/tests/template/author.php b/tests/phpunit/tests/template/author.php index 98fa735632..a84e8d8409 100644 --- a/tests/phpunit/tests/template/author.php +++ b/tests/phpunit/tests/template/author.php @@ -6,6 +6,25 @@ * @group template */ class Tests_Author_Template extends WP_UnitTestCase { + private $permalink_structure; + + public function setUp() { + parent::setUp(); + + global $wp_rewrite; + $this->permalink_structure = get_option( 'permalink_structure' ); + $wp_rewrite->set_permalink_structure( '' ); + $wp_rewrite->flush_rules(); + + } + + public function tearDown() { + global $wp_rewrite; + $wp_rewrite->set_permalink_structure( $this->permalink_structure ); + $wp_rewrite->flush_rules(); + + parent::tearDown(); + } /** * @ticket 30355 @@ -53,8 +72,6 @@ class Tests_Author_Template extends WP_UnitTestCase { $this->assertContains( 'Posts by Foo', $link ); $this->assertContains( '>Foo', $link ); - // Cleanup. - $wp_rewrite->set_permalink_structure( '' ); unset( $GLOBALS['authordata'] ); } }