diff --git a/tests/phpunit/tests/dependencies/jquery.php b/tests/phpunit/tests/dependencies/jquery.php index 6d738c5a52..aaacab67dc 100644 --- a/tests/phpunit/tests/dependencies/jquery.php +++ b/tests/phpunit/tests/dependencies/jquery.php @@ -50,14 +50,29 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase { 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs', 'jquery-ui-tooltip', 'jquery-ui-widget', 'backbone', 'underscore', ); + + add_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) ); + foreach ( $libraries as $library ) { // Try to deregister the script, which should fail. wp_deregister_script( $library ); $this->assertTrue( wp_script_is( $library, 'registered' ) ); } + + remove_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) ); + set_current_screen( 'front' ); } + function doing_it_wrong_run() { + add_filter( 'doing_it_wrong_trigger_error', array( $this, 'doing_it_wrong_trigger_error' ) ); + } + + function doing_it_wrong_trigger_error() { + remove_filter( 'doing_it_wrong_trigger_error', array( $this, 'doing_it_wrong_trigger_error' ) ); + return false; + } + /** * @ticket 24994 */