mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 18:54:29 +00:00
Remove non-built-in post statuses during each unit test teardown.
See #29167. git-svn-id: https://develop.svn.wordpress.org/trunk@31046 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -47,6 +47,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
|
||||
$this->reset_post_types();
|
||||
$this->reset_taxonomies();
|
||||
$this->reset_post_statuses();
|
||||
}
|
||||
|
||||
$this->start_transaction();
|
||||
@@ -107,6 +108,15 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
create_initial_taxonomies();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister non-built-in post statuses.
|
||||
*/
|
||||
protected function reset_post_statuses() {
|
||||
foreach ( get_post_stati( array( '_builtin' => false ) ) as $post_status ) {
|
||||
_unregister_post_status( $post_status );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the action and filter-related globals so they can be restored later.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user