Skip to content

Commit 7a5c889

Browse files
committed
Tests: Restore the rewrite object after rewrite tag tests.
Keep the sitemap rules registered at bootstrap available to subsequent canonical redirect tests. Developed in: #16250 Props mayankmajeji. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65796 602fd350-edb4-49c9-b593-d223f7449a82
1 parent abe7dd3 commit 7a5c889

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎tests/phpunit/tests/rewrite/rewriteTags.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@ class Tests_Rewrite_Tags extends WP_UnitTestCase {
88
protected $rewritereplace;
99
protected $queryreplace;
1010

11+
/**
12+
* The `WP_Rewrite` instance from before the test.
13+
*
14+
* @var WP_Rewrite
15+
*/
16+
private $orig_wp_rewrite;
17+
1118
public function set_up() {
1219
global $wp_rewrite;
1320
parent::set_up();
1421

22+
$this->orig_wp_rewrite = $wp_rewrite;
23+
1524
$wp_rewrite = new WP_Rewrite();
1625
$wp_rewrite->init();
1726

@@ -20,6 +29,12 @@ public function set_up() {
2029
$this->queryreplace = $wp_rewrite->queryreplace;
2130
}
2231

32+
public function tear_down() {
33+
$GLOBALS['wp_rewrite'] = $this->orig_wp_rewrite;
34+
35+
parent::tear_down();
36+
}
37+
2338
/**
2439
* @dataProvider data_add_rewrite_tag_invalid
2540
*

0 commit comments

Comments
 (0)