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
This commit is contained in:
Sergey Biryukov 2020-09-25 02:21:33 +00:00
parent 51a7210589
commit 5d1a29deaa

View File

@ -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 );