From e3f8b888ad2f8270a2e6d80fbf522210a94336ab Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 13 Oct 2015 15:21:20 +0000 Subject: [PATCH] In `WP_UnitTestCase`, only flush rewrite rules when they're set. See [34810]. See #33968. git-svn-id: https://develop.svn.wordpress.org/trunk@35136 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/testcase.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/testcase.php b/tests/phpunit/includes/testcase.php index 199f7eb745..5576940c33 100644 --- a/tests/phpunit/includes/testcase.php +++ b/tests/phpunit/includes/testcase.php @@ -30,7 +30,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase { $this->_backup_hooks(); } - global $wpdb; + global $wpdb, $wp_rewrite; $wpdb->suppress_errors = false; $wpdb->show_errors = true; $wpdb->db_connect(); @@ -48,7 +48,10 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase { $this->reset_post_types(); $this->reset_taxonomies(); $this->reset_post_statuses(); - $this->set_permalink_structure(); + + if ( $wp_rewrite->permalink_structure ) { + $this->set_permalink_structure( '' ); + } } $this->start_transaction();