diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2178ce2e42..abf5f00059 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -25,4 +25,7 @@ + + + diff --git a/tests/phpunit/includes/testcase.php b/tests/phpunit/includes/testcase.php index 42301644fb..3e4065644e 100644 --- a/tests/phpunit/includes/testcase.php +++ b/tests/phpunit/includes/testcase.php @@ -37,8 +37,18 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase { ini_set('display_errors', 1 ); $this->factory = new WP_UnitTest_Factory; $this->clean_up_global_scope(); - $this->reset_post_types(); - $this->reset_taxonomies(); + + /* + * When running core tests, ensure that post types and taxonomies + * are reset for each test. We skip this step for non-core tests, + * given the large number of plugins that register post types and + * taxonomies at 'init'. + */ + if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) { + $this->reset_post_types(); + $this->reset_taxonomies(); + } + $this->start_transaction(); $this->expectDeprecated(); add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );