From fa8791267978aebaa2f4d2826719e23dea071dad Mon Sep 17 00:00:00 2001 From: Kamran Abdul Aziz Date: Mon, 12 Oct 2026 21:26:31 +0530 Subject: [PATCH] Tests: Skip the PDF alpha channel test when the PDF cannot be loaded. `wp_image_editor_supports()` reports PDF support when Imagick lists the PDF format, even if Ghostscript is not installed, so the test failed instead of being skipped. Use the same `wp_get_image_editor()` check as the other PDF tests in `tests/phpunit/tests/image/functions.php`. See #65819. --- tests/phpunit/tests/image/editorImagick.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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.' );