From ee35baae6b74eebdc8721a26809278c3d2227174 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 12 Sep 2013 05:39:45 +0000 Subject: [PATCH] Suppress the `_doing_it_wrong` notices when calling `add_theme_support( 'html5' )` in `tests/theme/support.php` See #25282. git-svn-id: https://develop.svn.wordpress.org/trunk@25387 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/theme/support.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/phpunit/tests/theme/support.php b/tests/phpunit/tests/theme/support.php index 47f3698525..779231183a 100644 --- a/tests/phpunit/tests/theme/support.php +++ b/tests/phpunit/tests/theme/support.php @@ -5,6 +5,26 @@ */ class Tests_Theme_Support extends WP_UnitTestCase { + function setUp() { + parent::setUp(); + add_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) ); + } + + function tearDown() { + parent::tearDown(); + remove_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) ); + } + + function doing_it_wrong_run( $function ) { + if ( in_array( $function, array( "add_theme_support( 'html5' )" ) ) ) + 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; + } + function test_the_basics() { add_theme_support( 'automatic-feed-links' ); $this->assertTrue( current_theme_supports( 'automatic-feed-links' ) );