summaryrefslogtreecommitdiffstatshomepage
path: root/tests/phpunit/includes
diff options
context:
space:
mode:
authorJohn Blackbourn <johnbillion@git.wordpress.org>2021-02-27 17:08:26 +0000
committerJohn Blackbourn <johnbillion@git.wordpress.org>2021-02-27 17:08:26 +0000
commit055deeabff74e1a327fd7142f719622f7b6ff81e (patch)
tree864bf0fec2f21236e9d02e6582f0eef9c388c15c /tests/phpunit/includes
parent3542c3b4c0f40c6df81a6f475491b017f5f92263 (diff)
downloadwordpress-055deeabff74e1a327fd7142f719622f7b6ff81e.tar.gz
wordpress-055deeabff74e1a327fd7142f719622f7b6ff81e.zip
Build/Test Tools: Fix and standardise calls to the `tearDown()` method in the test suite.
The parent method should be called after any test-specific teardown. See #52625 git-svn-id: https://develop.svn.wordpress.org/trunk@50450 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'tests/phpunit/includes')
-rw-r--r--tests/phpunit/includes/testcase-ajax.php2
-rw-r--r--tests/phpunit/includes/testcase-block-supports.php4
-rw-r--r--tests/phpunit/includes/testcase-rest-controller.php2
3 files changed, 4 insertions, 4 deletions
diff --git a/tests/phpunit/includes/testcase-ajax.php b/tests/phpunit/includes/testcase-ajax.php
index 34fd32a392..c6db8305c6 100644
--- a/tests/phpunit/includes/testcase-ajax.php
+++ b/tests/phpunit/includes/testcase-ajax.php
@@ -157,7 +157,6 @@ abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase {
* Resets $_POST, removes the wp_die() override, restores error reporting.
*/
public function tearDown() {
- parent::tearDown();
$_POST = array();
$_GET = array();
unset( $GLOBALS['post'] );
@@ -166,6 +165,7 @@ abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase {
remove_action( 'clear_auth_cookie', array( $this, 'logout' ) );
error_reporting( $this->_error_level );
set_current_screen( 'front' );
+ parent::tearDown();
}
/**
diff --git a/tests/phpunit/includes/testcase-block-supports.php b/tests/phpunit/includes/testcase-block-supports.php
index f54dba8b9f..981bfcd190 100644
--- a/tests/phpunit/includes/testcase-block-supports.php
+++ b/tests/phpunit/includes/testcase-block-supports.php
@@ -19,12 +19,12 @@ class Block_Supported_Styles_Test extends WP_UnitTestCase {
* Tear down each test method.
*/
public function tearDown() {
- parent::tearDown();
-
while ( ! empty( $this->registered_block_names ) ) {
$block_name = array_pop( $this->registered_block_names );
unregister_block_type( $block_name );
}
+
+ parent::tearDown();
}
/**
diff --git a/tests/phpunit/includes/testcase-rest-controller.php b/tests/phpunit/includes/testcase-rest-controller.php
index bc7d409368..2c79df11be 100644
--- a/tests/phpunit/includes/testcase-rest-controller.php
+++ b/tests/phpunit/includes/testcase-rest-controller.php
@@ -14,11 +14,11 @@ abstract class WP_Test_REST_Controller_Testcase extends WP_Test_REST_TestCase {
}
public function tearDown() {
- parent::tearDown();
remove_filter( 'rest_url', array( $this, 'test_rest_url_for_leading_slash' ), 10, 2 );
/** @var WP_REST_Server $wp_rest_server */
global $wp_rest_server;
$wp_rest_server = null;
+ parent::tearDown();
}
abstract public function test_register_routes();