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
This commit is contained in:
Boone Gorges 2015-10-13 15:21:20 +00:00
parent 5e37130fcd
commit e3f8b888ad

View File

@ -30,7 +30,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
$this->_backup_hooks(); $this->_backup_hooks();
} }
global $wpdb; global $wpdb, $wp_rewrite;
$wpdb->suppress_errors = false; $wpdb->suppress_errors = false;
$wpdb->show_errors = true; $wpdb->show_errors = true;
$wpdb->db_connect(); $wpdb->db_connect();
@ -48,7 +48,10 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
$this->reset_post_types(); $this->reset_post_types();
$this->reset_taxonomies(); $this->reset_taxonomies();
$this->reset_post_statuses(); $this->reset_post_statuses();
$this->set_permalink_structure();
if ( $wp_rewrite->permalink_structure ) {
$this->set_permalink_structure( '' );
}
} }
$this->start_transaction(); $this->start_transaction();