diff --git a/tests/phpunit/tests/formatting/CleanPre.php b/tests/phpunit/tests/formatting/CleanPre.php index fb5eea90df..410b5095f8 100644 --- a/tests/phpunit/tests/formatting/CleanPre.php +++ b/tests/phpunit/tests/formatting/CleanPre.php @@ -7,6 +7,26 @@ * @group formatting */ class Tests_Formatting_CleanPre extends WP_UnitTestCase { + function setUp() { + parent::setUp(); + add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) ); + } + + function tearDown() { + parent::tearDown(); + remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) ); + } + + function deprecated_function_run_check( $function ) { + if ( in_array( $function, array( 'clean_pre' ) ) ) + add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) ); + } + + function deprecated_function_trigger_error() { + remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) ); + return false; + } + function test_removes_self_closing_br_with_space() { $source = 'a b c\n
sldfj
'; $res = 'a b c\nsldfj';