diff --git a/tests/phpunit/tests/image/functions.php b/tests/phpunit/tests/image/functions.php index a9b0a6eb18..9105f244a1 100644 --- a/tests/phpunit/tests/image/functions.php +++ b/tests/phpunit/tests/image/functions.php @@ -27,6 +27,28 @@ class Tests_Image_Functions extends WP_UnitTestCase { } } + /** + * Get the available image editor engine class(es). + * + * @return string[] Available image editor classes; empty array when none are available. + */ + private function get_image_editor_engine_classes() { + $classes = array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' ); + + foreach ( $classes as $key => $class ) { + if ( ! call_user_func( array( $class, 'test' ) ) ) { + // If the image editor isn't available, skip it. + unset( $classes[ $key ] ); + } + } + + if ( empty( $classes ) ) { + $this->markTestSkipped( 'Image editor engines WP_Image_Editor_GD and WP_Image_Editor_Imagick are not supported on this system.' ); + } + + return $classes; + } + /** * Get the MIME type of a file * @@ -320,28 +342,6 @@ class Tests_Image_Functions extends WP_UnitTestCase { } } - /** - * Get the available image editor engine class(es). - * - * @return string[] Available image editor classes; empty array when none are avaialble. - */ - private function get_image_editor_engine_classes() { - $classes = array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' ); - - foreach ( $classes as $key => $class ) { - if ( ! call_user_func( array( $class, 'test' ) ) ) { - // If the image editor isn't available, skip it. - unset( $classes[ $key ] ); - } - } - - if ( empty( $classes ) ) { - $this->markTestSkipped( 'Image editor engines WP_Image_Editor_GD and WP_Image_Editor_Imagick are not supported on this system.' ); - } - - return $classes; - } - /** * @ticket 55403 */ @@ -446,10 +446,6 @@ class Tests_Image_Functions extends WP_UnitTestCase { $this->assertInstanceOf( 'WP_Error', $file ); } - public function mock_image_editor( $editors ) { - return array( 'WP_Image_Editor_Mock' ); - } - /** * @ticket 23325 */ @@ -472,6 +468,13 @@ class Tests_Image_Functions extends WP_UnitTestCase { WP_Image_Editor_Mock::$save_return = array(); } + /** + * @see test_wp_crop_image_error_on_saving() + */ + public function mock_image_editor( $editors ) { + return array( 'WP_Image_Editor_Mock' ); + } + /** * @ticket 31050 */