From 6505f413006b226bbb83517ce1c5e611f46c380d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 6 Jun 2026 09:49:23 +0000 Subject: [PATCH 1/3] Initial plan From 3146b65c9d6a173a8da323087eb80453e636a591 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 6 Jun 2026 09:59:29 +0000 Subject: [PATCH 2/3] tests: avoid forcing imagick when core formats unavailable Co-authored-by: westonruter <134745+westonruter@users.noreply.github.com> --- .../tests/test-dominant-color-image-editor-imagick.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php b/plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php index 5e30e89d51..372a4ee80a 100644 --- a/plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php +++ b/plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php @@ -26,6 +26,13 @@ public function set_up(): void { $this->markTestSkipped( 'The Imagick PHP extension is not loaded.' ); } + $required_formats = array( 'JPEG', 'PNG', 'GIF', 'WEBP' ); + foreach ( $required_formats as $required_format ) { + if ( ! in_array( $required_format, Imagick::queryFormats( $required_format ), true ) ) { + return; + } + } + add_filter( 'wp_image_editors', static function ( array $editors ): array { From e708b8fd4972db07244ae7e86846c65ff344b19a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 6 Jun 2026 10:03:45 +0000 Subject: [PATCH 3/3] tests: make imagick editor filter conditional on format support Co-authored-by: westonruter <134745+westonruter@users.noreply.github.com> --- ...st-dominant-color-image-editor-imagick.php | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php b/plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php index 372a4ee80a..7e99eb728d 100644 --- a/plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php +++ b/plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php @@ -27,23 +27,25 @@ public function set_up(): void { } $required_formats = array( 'JPEG', 'PNG', 'GIF', 'WEBP' ); - foreach ( $required_formats as $required_format ) { - if ( ! in_array( $required_format, Imagick::queryFormats( $required_format ), true ) ) { - return; - } + try { + $supported_formats = Imagick::queryFormats(); + } catch ( Exception $exception ) { + $this->markTestSkipped( sprintf( 'Unable to query Imagick formats: %s', $exception->getMessage() ) ); + } + $missing_formats = array_diff( $required_formats, $supported_formats ); + if ( 0 === count( $missing_formats ) ) { + add_filter( + 'wp_image_editors', + static function ( array $editors ): array { + return array_filter( + $editors, + static function ( $editor ): bool { + return WP_Image_Editor_Imagick::class === $editor; + } + ); + } + ); } - - add_filter( - 'wp_image_editors', - static function ( array $editors ): array { - return array_filter( - $editors, - static function ( $editor ): bool { - return WP_Image_Editor_Imagick::class === $editor; - } - ); - } - ); } /**