From 5d1a29deaafbeec49888345da451ff2038766121 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 25 Sep 2020 02:21:33 +0000 Subject: [PATCH] Tests: Require `imagejpeg()` function in some REST API attachments controller tests. This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test. These tests rely on multiple resized copies of a test JPEG image being generated and available. Follow-up to [49010], [49024], [49025], [49045]. See #50639, #50640. git-svn-id: https://develop.svn.wordpress.org/trunk@49047 602fd350-edb4-49c9-b593-d223f7449a82 --- .../phpunit/tests/rest-api/rest-attachments-controller.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/phpunit/tests/rest-api/rest-attachments-controller.php b/tests/phpunit/tests/rest-api/rest-attachments-controller.php index 5fd0b46c6f..b4115d41e7 100644 --- a/tests/phpunit/tests/rest-api/rest-attachments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-attachments-controller.php @@ -583,6 +583,9 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control $this->assertSame( 'image/jpeg', $data['mime_type'] ); } + /** + * @requires function imagejpeg + */ public function test_get_item_sizes() { $attachment_id = $this->factory->attachment->create_object( $this->test_file, @@ -611,6 +614,9 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control $this->assertSame( 'image/jpeg', $data['media_details']['sizes']['full']['mime_type'] ); } + /** + * @requires function imagejpeg + */ public function test_get_item_sizes_with_no_url() { $attachment_id = $this->factory->attachment->create_object( $this->test_file, @@ -1944,6 +1950,7 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control /** * @ticket 44405 + * @requires function imagejpeg */ public function test_edit_image() { wp_set_current_user( self::$superadmin_id );