From fe85e7832994e0bdb526d1eed9be39f800da05c7 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 29 Apr 2016 16:15:37 +0000 Subject: [PATCH] Media/Unit Tests: ensure that the GD absrtraction is used for GD unit tests for Images. Some of the procedural GD API functions can still throw `ImagickException`, which is fun. See #36588. git-svn-id: https://develop.svn.wordpress.org/trunk@37327 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/image/resize.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/phpunit/tests/image/resize.php b/tests/phpunit/tests/image/resize.php index d3b78fa9f3..807b51ce1f 100644 --- a/tests/phpunit/tests/image/resize.php +++ b/tests/phpunit/tests/image/resize.php @@ -10,6 +10,22 @@ require_once( dirname( __FILE__ ) . '/base.php' ); abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase { + public function setUp() { + parent::setUp(); + + add_filter( 'wp_image_editors', array( $this, 'wp_image_editors' ) ); + } + + public function tearDown() { + remove_filter( 'wp_image_editors', array( $this, 'wp_image_editors' ) ); + + parent::tearDown(); + } + + public function wp_image_editors() { + return array( $this->editor_engine ); + } + function test_resize_jpg() { $image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.jpg', 25, 25 );