diff --git a/tests/phpunit/tests/admin/includesScreen.php b/tests/phpunit/tests/admin/includesScreen.php index 704dc50a75..b1333ce816 100644 --- a/tests/phpunit/tests/admin/includesScreen.php +++ b/tests/phpunit/tests/admin/includesScreen.php @@ -37,9 +37,9 @@ class Tests_Admin_includesScreen extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); unset( $GLOBALS['wp_taxonomies']['old-or-new'] ); set_current_screen( 'front' ); + parent::tearDown(); } function test_set_current_screen_with_hook_suffix() { diff --git a/tests/phpunit/tests/ajax/Autosave.php b/tests/phpunit/tests/ajax/Autosave.php index a96e6cf898..0aa37855b8 100644 --- a/tests/phpunit/tests/ajax/Autosave.php +++ b/tests/phpunit/tests/ajax/Autosave.php @@ -46,8 +46,8 @@ class Tests_Ajax_Autosave extends WP_Ajax_UnitTestCase { * Reset the current user */ public function tearDown() { - parent::tearDown(); wp_set_current_user( 0 ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/ajax/ReplytoComment.php b/tests/phpunit/tests/ajax/ReplytoComment.php index 2b5b404c9a..9e07051c5d 100644 --- a/tests/phpunit/tests/ajax/ReplytoComment.php +++ b/tests/phpunit/tests/ajax/ReplytoComment.php @@ -43,8 +43,8 @@ class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase { } public function tearDown() { - parent::tearDown(); remove_filter( 'query', array( $this, '_block_comments' ) ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/ajax/Response.php b/tests/phpunit/tests/ajax/Response.php index 9626d752dd..c987bf7ccb 100644 --- a/tests/phpunit/tests/ajax/Response.php +++ b/tests/phpunit/tests/ajax/Response.php @@ -36,9 +36,9 @@ class Tests_Ajax_Response extends WP_UnitTestCase { * Remove the wp_die() override, restore error reporting */ public function tearDown() { - parent::tearDown(); remove_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 ); error_reporting( $this->_error_level ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/basic.php b/tests/phpunit/tests/basic.php index 06cf909c0c..3370f8ca21 100644 --- a/tests/phpunit/tests/basic.php +++ b/tests/phpunit/tests/basic.php @@ -13,8 +13,8 @@ class Tests_Basic extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); $this->val = false; + parent::tearDown(); } function test_true() { diff --git a/tests/phpunit/tests/cache.php b/tests/phpunit/tests/cache.php index dce0cd791e..fd93a0940b 100644 --- a/tests/phpunit/tests/cache.php +++ b/tests/phpunit/tests/cache.php @@ -14,8 +14,8 @@ class Tests_Cache extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); $this->flush_cache(); + parent::tearDown(); } function &init_cache() { diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index c06507b74d..d69abcc757 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -23,8 +23,8 @@ class Tests_Canonical extends WP_Canonical_UnitTestCase { } public function tearDown() { - parent::tearDown(); wp_set_current_user( self::$old_current_user ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/canonical/pageOnFront.php b/tests/phpunit/tests/canonical/pageOnFront.php index 26d360314f..8bfb8cefbe 100644 --- a/tests/phpunit/tests/canonical/pageOnFront.php +++ b/tests/phpunit/tests/canonical/pageOnFront.php @@ -26,8 +26,8 @@ class Tests_Canonical_PageOnFront extends WP_Canonical_UnitTestCase { function tearDown() { global $wp_rewrite; - parent::tearDown(); $wp_rewrite->init(); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/category.php b/tests/phpunit/tests/category.php index 1d3334a879..eed89e4a54 100644 --- a/tests/phpunit/tests/category.php +++ b/tests/phpunit/tests/category.php @@ -10,9 +10,8 @@ class Tests_Category extends WP_UnitTestCase { function tearDown() { - parent::tearDown(); - _unregister_taxonomy( 'test_tax_cat' ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/comment/getCommentsPagesCount.php b/tests/phpunit/tests/comment/getCommentsPagesCount.php index d694771795..79a869bf57 100644 --- a/tests/phpunit/tests/comment/getCommentsPagesCount.php +++ b/tests/phpunit/tests/comment/getCommentsPagesCount.php @@ -26,11 +26,11 @@ class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase { * tearDown options */ function tearDown() { - parent::tearDown(); update_option( 'page_comments', $this->option_page_comments ); update_option( 'comments_per_page', $this->option_page_comments ); update_option( 'thread_comments', $this->option_page_comments ); update_option( 'posts_per_rss', $this->option_posts_per_rss ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/cron.php b/tests/phpunit/tests/cron.php index 2d96c2e765..b411a5be1e 100644 --- a/tests/phpunit/tests/cron.php +++ b/tests/phpunit/tests/cron.php @@ -13,9 +13,9 @@ class Tests_Cron extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); // make sure the schedule is clear _set_cron_array(array()); + parent::tearDown(); } function test_wp_get_schedule_empty() { diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index f669d7f92f..9f8d8369cc 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -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(); } /** diff --git a/tests/phpunit/tests/customize/setting.php b/tests/phpunit/tests/customize/setting.php index a783287e20..388cf1aefd 100644 --- a/tests/phpunit/tests/customize/setting.php +++ b/tests/phpunit/tests/customize/setting.php @@ -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() { diff --git a/tests/phpunit/tests/customize/widgets.php b/tests/phpunit/tests/customize/widgets.php index 8decbefde6..9f30b9495c 100644 --- a/tests/phpunit/tests/customize/widgets.php +++ b/tests/phpunit/tests/customize/widgets.php @@ -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 ) { diff --git a/tests/phpunit/tests/image/base.php b/tests/phpunit/tests/image/base.php index d417cf17ea..3cf6d04667 100644 --- a/tests/phpunit/tests/image/base.php +++ b/tests/phpunit/tests/image/base.php @@ -22,9 +22,8 @@ abstract class WP_Image_UnitTestCase extends WP_UnitTestCase { * Undo the image editor override */ public function tearDown() { - parent::tearDown(); - remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/link.php b/tests/phpunit/tests/link.php index c11416bfd5..1090efe6a5 100644 --- a/tests/phpunit/tests/link.php +++ b/tests/phpunit/tests/link.php @@ -6,8 +6,8 @@ class Tests_Link extends WP_UnitTestCase { function tearDown() { global $wp_rewrite; - parent::tearDown(); $wp_rewrite->init(); + parent::tearDown(); } function _get_pagenum_link_cb( $url ) { diff --git a/tests/phpunit/tests/mail.php b/tests/phpunit/tests/mail.php index 547ed998c3..2ca73dd1ec 100644 --- a/tests/phpunit/tests/mail.php +++ b/tests/phpunit/tests/mail.php @@ -11,8 +11,8 @@ class Tests_Mail extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); unset( $_SERVER['SERVER_NAME'] ); + parent::tearDown(); } function test_wp_mail_custom_boundaries() { diff --git a/tests/phpunit/tests/multisite/bootstrap.php b/tests/phpunit/tests/multisite/bootstrap.php index f9f59f6bb3..ddffd565e9 100644 --- a/tests/phpunit/tests/multisite/bootstrap.php +++ b/tests/phpunit/tests/multisite/bootstrap.php @@ -21,8 +21,8 @@ class Tests_Multisite_Bootstrap extends WP_UnitTestCase { function tearDown() { global $wpdb; - parent::tearDown(); $wpdb->suppress_errors( $this->suppress ); + parent::tearDown(); } diff --git a/tests/phpunit/tests/multisite/ms-files-rewriting.php b/tests/phpunit/tests/multisite/ms-files-rewriting.php index d36b4d89a7..915448d7ee 100644 --- a/tests/phpunit/tests/multisite/ms-files-rewriting.php +++ b/tests/phpunit/tests/multisite/ms-files-rewriting.php @@ -29,8 +29,9 @@ class Tests_Multisite_MS_Files_Rewriting extends WP_UnitTestCase { global $wpdb; update_site_option( 'ms_files_rewriting', 0 ); - parent::tearDown(); $wpdb->suppress_errors( $this->suppress ); + + parent::tearDown(); } function test_switch_upload_dir() { diff --git a/tests/phpunit/tests/multisite/network.php b/tests/phpunit/tests/multisite/network.php index 058f411282..5373bf8fba 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -22,8 +22,8 @@ class Tests_Multisite_Network extends WP_UnitTestCase { function tearDown() { global $wpdb; - parent::tearDown(); $wpdb->suppress_errors( $this->suppress ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php index 3924e51905..0ad1b8533d 100644 --- a/tests/phpunit/tests/multisite/site.php +++ b/tests/phpunit/tests/multisite/site.php @@ -21,8 +21,8 @@ class Tests_Multisite_Site extends WP_UnitTestCase { function tearDown() { global $wpdb; - parent::tearDown(); $wpdb->suppress_errors( $this->suppress ); + parent::tearDown(); } function test_switch_restore_blog() { diff --git a/tests/phpunit/tests/option/multisite.php b/tests/phpunit/tests/option/multisite.php index af419ea875..34aaf92035 100644 --- a/tests/phpunit/tests/option/multisite.php +++ b/tests/phpunit/tests/option/multisite.php @@ -22,8 +22,8 @@ class Tests_Multisite_Option extends WP_UnitTestCase { function tearDown() { global $wpdb; - parent::tearDown(); $wpdb->suppress_errors( $this->suppress ); + parent::tearDown(); } function test_from_same_site() { diff --git a/tests/phpunit/tests/post/meta.php b/tests/phpunit/tests/post/meta.php index 572aa8ad77..2fb883f53c 100644 --- a/tests/phpunit/tests/post/meta.php +++ b/tests/phpunit/tests/post/meta.php @@ -33,9 +33,9 @@ class Tests_Post_Meta extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); wp_delete_post($this->post_id); wp_delete_post($this->post_id_2); + parent::tearDown(); } function test_unique_postmeta() { diff --git a/tests/phpunit/tests/post/revisions.php b/tests/phpunit/tests/post/revisions.php index ea0632baba..7a5ea0300f 100644 --- a/tests/phpunit/tests/post/revisions.php +++ b/tests/phpunit/tests/post/revisions.php @@ -12,8 +12,8 @@ class Tests_Post_Revisions extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); unset( $GLOBALS['wp_post_types'][ $this->post_type ] ); + parent::tearDown(); } /** diff --git a/tests/phpunit/tests/query/conditionals.php b/tests/phpunit/tests/query/conditionals.php index 8d4b600ef5..e86d337821 100644 --- a/tests/phpunit/tests/query/conditionals.php +++ b/tests/phpunit/tests/query/conditionals.php @@ -34,8 +34,9 @@ class Tests_Query_Conditionals extends WP_UnitTestCase { function tearDown() { global $wp_rewrite; - parent::tearDown(); $wp_rewrite->init(); + + parent::tearDown(); } function test_home() { diff --git a/tests/phpunit/tests/query/isTerm.php b/tests/phpunit/tests/query/isTerm.php index 6ceff16974..ec93ce6f49 100644 --- a/tests/phpunit/tests/query/isTerm.php +++ b/tests/phpunit/tests/query/isTerm.php @@ -59,13 +59,13 @@ class Tests_Query_IsTerm extends WP_UnitTestCase { function tearDown() { global $wp_rewrite; - parent::tearDown(); _unregister_taxonomy( 'testtax' ); $wp_rewrite->init(); remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) ); + parent::tearDown(); } function test_tag_action_tax() { diff --git a/tests/phpunit/tests/query/search.php b/tests/phpunit/tests/query/search.php index d3b67b4dd0..9ef912667d 100644 --- a/tests/phpunit/tests/query/search.php +++ b/tests/phpunit/tests/query/search.php @@ -18,10 +18,10 @@ class Tests_Query_Search extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); - _unregister_post_type( $this->post_type ); unset( $this->q ); + + parent::tearDown(); } function get_search_results( $terms ) { diff --git a/tests/phpunit/tests/rewrite.php b/tests/phpunit/tests/rewrite.php index 1e3606eabb..1c5822aa40 100644 --- a/tests/phpunit/tests/rewrite.php +++ b/tests/phpunit/tests/rewrite.php @@ -22,8 +22,9 @@ class Tests_Rewrite extends WP_UnitTestCase { function tearDown() { global $wp_rewrite; - parent::tearDown(); $wp_rewrite->init(); + + parent::tearDown(); } function test_url_to_postid() { diff --git a/tests/phpunit/tests/shortcode.php b/tests/phpunit/tests/shortcode.php index 2a966bf15d..daa3a58ac1 100644 --- a/tests/phpunit/tests/shortcode.php +++ b/tests/phpunit/tests/shortcode.php @@ -20,9 +20,9 @@ class Tests_Shortcode extends WP_UnitTestCase { function tearDown() { global $shortcode_tags; - parent::tearDown(); foreach ( $this->shortcodes as $shortcode ) unset( $shortcode_tags[ $shortcode ] ); + parent::tearDown(); } function _shortcode_test_shortcode_tag( $atts, $content = null, $tagname = null ) { diff --git a/tests/phpunit/tests/user/countUserPosts.php b/tests/phpunit/tests/user/countUserPosts.php index 4a1746dec8..00367c8e2c 100644 --- a/tests/phpunit/tests/user/countUserPosts.php +++ b/tests/phpunit/tests/user/countUserPosts.php @@ -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() { diff --git a/tests/phpunit/tests/user/mapMetaCap.php b/tests/phpunit/tests/user/mapMetaCap.php index 33b7f00d59..27b8b8fe75 100644 --- a/tests/phpunit/tests/user/mapMetaCap.php +++ b/tests/phpunit/tests/user/mapMetaCap.php @@ -32,10 +32,9 @@ class Tests_User_MapMetaCap extends WP_UnitTestCase { } function tearDown() { - parent::tearDown(); - $GLOBALS['super_admins'] = $this->super_admins; unset( $GLOBALS['wp_post_types'][ $this->post_type ] ); + parent::tearDown(); } function test_capability_type_post_with_no_extra_caps() { diff --git a/tests/phpunit/tests/user/multisite.php b/tests/phpunit/tests/user/multisite.php index 42ec84fdb4..0df47d8578 100644 --- a/tests/phpunit/tests/user/multisite.php +++ b/tests/phpunit/tests/user/multisite.php @@ -22,8 +22,8 @@ class Tests_Multisite_User extends WP_UnitTestCase { function tearDown() { global $wpdb; - parent::tearDown(); $wpdb->suppress_errors( $this->suppress ); + parent::tearDown(); } function test_remove_user_from_blog() { diff --git a/tests/phpunit/tests/xmlrpc/wp/getPage.php b/tests/phpunit/tests/xmlrpc/wp/getPage.php index 1dc860d4fb..c20f27b907 100644 --- a/tests/phpunit/tests/xmlrpc/wp/getPage.php +++ b/tests/phpunit/tests/xmlrpc/wp/getPage.php @@ -24,9 +24,8 @@ class Tests_XMLRPC_wp_getPage extends WP_XMLRPC_UnitTestCase { } function tearDown() { - parent::tearDown(); - wp_delete_post( $this->post_id ); + parent::tearDown(); } function test_invalid_username_password() {