mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 04:34:31 +00:00
In PHPUnit test classes, parent::tearDown() should be the last thing done in tearDown() methods.
`WP_UnitTestCase::tearDown()` restores the test environment to the default conditions, including rolling back the MySQL transaction that the test takes place in, resetting globals, and unhooking test-specific filters. As such, all teardown routines for specific tests should happen before the parent class's `tearDown()` method is called. Failure to do so can cause database locks on certain configurations, among other problems. See #31537. git-svn-id: https://develop.svn.wordpress.org/trunk@31622 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -57,8 +57,8 @@ class Tests_User_CountUserPosts extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
_unregister_post_type( 'wptests_pt' );
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function test_count_user_posts_post_type_should_default_to_post() {
|
||||
|
||||
Reference in New Issue
Block a user