From 7001aeaa111b665c71a9086f19262b99991e34e8 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 12 Sep 2013 04:20:48 +0000 Subject: [PATCH] Suppress the deprecated function notice in `tests/formatting/CleanPre.php` See #25282. git-svn-id: https://develop.svn.wordpress.org/trunk@25378 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/formatting/CleanPre.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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';