From 01f25fa247df610688f162e56046033004811e7f Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sat, 3 Oct 2015 19:26:24 +0000 Subject: [PATCH] Tests: Last try: It's redundant to reset permalinks on `tearDown()` if we're already doing it on every `setUp()`. Removes the restoration logic, which leveraged a static property initialized with `get_option()`. See #33968. git-svn-id: https://develop.svn.wordpress.org/trunk@34807 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/testcase.php | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/tests/phpunit/includes/testcase.php b/tests/phpunit/includes/testcase.php index 3200dd2c7b..17631bbb2f 100644 --- a/tests/phpunit/includes/testcase.php +++ b/tests/phpunit/includes/testcase.php @@ -16,8 +16,6 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase { protected $db_version; - public static $default_permalink_structure; - /** * @var WP_UnitTest_Factory */ @@ -42,8 +40,6 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase { $this->factory = new WP_UnitTest_Factory; $this->clean_up_global_scope(); - self::$default_permalink_structure = get_option( 'permalink_structure' ); - /* * When running core tests, ensure that post types and taxonomies * are reset for each test. We skip this step for non-core tests, @@ -104,8 +100,6 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase { remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) ); $this->_restore_hooks(); wp_set_current_user( 0 ); - - $this->reset_permalinks( $restore = true ); } function clean_up_global_scope() { @@ -656,26 +650,15 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase { /** * Utility method that resets permalinks and flushes rewrites. * - * Collects the current permalink structure and stores it in a class property for use - * by sub-classes. - * * @since 4.4.0 * * @global WP_Rewrite $wp_rewrite - * - * @param bool $restore_default Optional. Whether to restore the default permalink structure. - * Default false. */ - public function reset_permalinks( $restore_default = false ) { + public function reset_permalinks() { global $wp_rewrite; - if ( ! $restore_default ) { - $wp_rewrite->init(); - $wp_rewrite->set_permalink_structure( '' ); - } else { - $wp_rewrite->set_permalink_structure( self::$default_permalink_structure ); - } - + $wp_rewrite->init(); + $wp_rewrite->set_permalink_structure( '' ); $wp_rewrite->flush_rules(); } }