mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +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:
@@ -16,9 +16,9 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
parent::tearDown();
|
||||
$this->manager = null;
|
||||
unset( $GLOBALS['wp_customize'] );
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,9 +26,9 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
parent::tearDown();
|
||||
$this->manager = null;
|
||||
unset( $GLOBALS['wp_customize'] );
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
function test_constructor_without_args() {
|
||||
|
||||
@@ -35,10 +35,10 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
parent::tearDown();
|
||||
$this->manager = null;
|
||||
unset( $GLOBALS['wp_customize'] );
|
||||
unset( $GLOBALS['wp_scripts'] );
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
function set_customized_post_data( $customized ) {
|
||||
|
||||
Reference in New Issue
Block a user