Repository navigation
Conversation
`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.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
PR #14214 landed in https://core.trac.wordpress.org/changeset/64318 |
Check that `wp_get_image_editor()` can load the PDF before testing alpha-channel removal. ImageMagick can advertise PDF support when Ghostscript is unavailable. Match the existing PDF tests while preserving the preview and pixel assertions on supported systems. Developed in: #14214 Props ekamran. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64318 602fd350-edb4-49c9-b593-d223f7449a82
Check that `wp_get_image_editor()` can load the PDF before testing alpha-channel removal. ImageMagick can advertise PDF support when Ghostscript is unavailable. Match the existing PDF tests while preserving the preview and pixel assertions on supported systems. Developed in: WordPress/wordpress-develop#14214 Props ekamran. See #65819. Built from https://develop.svn.wordpress.org/trunk@64318 git-svn-id: http://core.svn.wordpress.org/trunk@63468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open finding
What changed in this PR
Updates the Imagick PDF alpha-channel test to skip when WordPress cannot actually load the PDF (e.g., Imagick present but Ghostscript missing), aligning behavior with existing PDF tests.
Changes:
- Adds a
wp_get_image_editor()loadability check before running the PDF preview/assertions. - Skips the test with the underlying
WP_Errormessage when the editor cannot load the PDF.
| File | Description |
|---|---|
| tests/phpunit/tests/image/editorImagick.php | Adds an editor instantiation check to skip the PDF alpha channel test when PDF loading fails (commonly due to missing Ghostscript). |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| $editor = wp_get_image_editor( $test_file ); | ||
| if ( is_wp_error( $editor ) ) { | ||
| $this->markTestSkipped( $editor->get_error_message() ); |

test_remove_pdf_alpha_channel_should_remove_the_alpha_channel_in_preview()fails when Imagick is installed but Ghostscript is not, with "The intermediate size could not be retrieved."The test skips only when
wp_image_editor_supports()reports no PDF support. That check usesImagick::queryFormats(), which still listsPDFwhen Ghostscript is missing, as noted in https://core.trac.wordpress.org/ticket/45813. So the test runs, no preview is generated, and the assertion fails.The four PDF tests in
tests/phpunit/tests/image/functions.phpalready skip in this case. r48341 gave them a second check that loads the file withwp_get_image_editor(). This test was added later, in r56271, without it. This PR adds the same check.Where it shows up:
master, for example https://github.com/WordPress/phpunit-test-runner/actions/runs/38256520334. That CI runs on GitHub'subuntu-24.04image, which does not list Ghostscript in its installed software.Testing
I ran the alpha channel test and the four
functions.phpPDF tests on Ubuntu 24.04 (PHP 8.3.6, ImageMagick 6.9.12-98) and on thewordpressdevelop/phpimage (PHP 8.3.35, ImageMagick 7.1.1-43). In the image, I renamed/usr/bin/gsfor the runs without Ghostscript.Both environments gave the same results.
vendor/bin/phpcson the changed file is clean.Trac ticket: https://core.trac.wordpress.org/ticket/65819
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code, Codex (testing and review)
The investigation, verification and final decisions are mine, and I take responsibility for the change.