From a3a7be77e3eb2cf81285e4832cba9cac2b0e60a3 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 11 Sep 2013 22:16:43 +0000 Subject: [PATCH] Suppress deprecated notices for `wp_shrink_dimensions()`. See #25282. git-svn-id: https://develop.svn.wordpress.org/trunk@25367 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/image/size.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/phpunit/tests/image/size.php b/tests/phpunit/tests/image/size.php index a55545ced6..da50606082 100644 --- a/tests/phpunit/tests/image/size.php +++ b/tests/phpunit/tests/image/size.php @@ -6,6 +6,28 @@ * @group upload */ class Tests_Image_Size 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( 'wp_shrink_dimensions' ) ) ) + add_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) ); + } + + function filter_deprecated_function_trigger_error() { + remove_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) ); + return false; + } + function test_constrain_dims_zero() { if (!is_callable('wp_constrain_dimensions')) $this->markTestSkipped('wp_constrain_dimensions() is not callable.');