From a77ccfad806bf78ee52b631646ce617803e51e96 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 23 Oct 2017 05:10:25 +0000 Subject: [PATCH] Build/Test tools: Move `wp_doing_ajax` defintion from class setup to test setup. Moves defintion of ajax request in `WP_Ajax_UnitTestCase` to `setUp()` method to account for hooks being reset as part of `tearDown()`. Props matthias.thiel for report. Fixes #41561. git-svn-id: https://develop.svn.wordpress.org/trunk@41970 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/testcase-ajax.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/phpunit/includes/testcase-ajax.php b/tests/phpunit/includes/testcase-ajax.php index 2227413511..76ceb73af1 100644 --- a/tests/phpunit/includes/testcase-ajax.php +++ b/tests/phpunit/includes/testcase-ajax.php @@ -59,8 +59,6 @@ abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase { ); public static function setUpBeforeClass() { - add_filter( 'wp_doing_ajax', '__return_true' ); - remove_action( 'admin_init', '_maybe_update_core' ); remove_action( 'admin_init', '_maybe_update_plugins' ); remove_action( 'admin_init', '_maybe_update_themes' ); @@ -82,6 +80,7 @@ abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase { public function setUp() { parent::setUp(); + add_filter( 'wp_doing_ajax', '__return_true' ); add_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 ); set_current_screen( 'ajax' );