diff --git a/tests/phpunit/tests/image/editorImagick.php b/tests/phpunit/tests/image/editorImagick.php index e120c32502ad5..8c6b9375b4577 100644 --- a/tests/phpunit/tests/image/editorImagick.php +++ b/tests/phpunit/tests/image/editorImagick.php @@ -665,7 +665,13 @@ public function test_remove_pdf_alpha_channel_should_remove_the_alpha_channel_in $this->markTestSkipped( 'The version of ImageMagick does not support removing alpha channels from PDFs.' ); } - $test_file = DIR_TESTDATA . '/images/test-alpha.pdf'; + $test_file = DIR_TESTDATA . '/images/test-alpha.pdf'; + + $editor = wp_get_image_editor( $test_file ); + if ( is_wp_error( $editor ) ) { + $this->markTestSkipped( $editor->get_error_message() ); + } + $attachment_id = $this->factory->attachment->create_upload_object( $test_file ); $this->assertNotEmpty( $attachment_id, 'The attachment was not created before testing.' );