Tests: Flush rewrite rules between tests in an attempt to avoid permalinks pollution in Tests_Author_Template.

See #30355.


git-svn-id: https://develop.svn.wordpress.org/trunk@34678 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes 2015-09-29 02:18:55 +00:00
parent 3edc3b46f2
commit 58d7f89bf7

View File

@ -6,6 +6,25 @@
* @group template * @group template
*/ */
class Tests_Author_Template extends WP_UnitTestCase { 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 * @ticket 30355
@ -53,8 +72,6 @@ class Tests_Author_Template extends WP_UnitTestCase {
$this->assertContains( 'Posts by Foo', $link ); $this->assertContains( 'Posts by Foo', $link );
$this->assertContains( '>Foo</a>', $link ); $this->assertContains( '>Foo</a>', $link );
// Cleanup.
$wp_rewrite->set_permalink_structure( '' );
unset( $GLOBALS['authordata'] ); unset( $GLOBALS['authordata'] );
} }
} }