From dabce6b2222fd01ddefd667d3e0c6c83a8b80351 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 12 Sep 2025 15:39:24 -0400 Subject: [PATCH 1/9] Remove unnecessary filter The `WP_Image_UnitTestCase` base class already has a filter for `wp_image_editors` that returns the value of `$this->editor_engine`, so this is unnecessary here. --- tests/phpunit/tests/image/resize.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/phpunit/tests/image/resize.php b/tests/phpunit/tests/image/resize.php index f4fe8632a0580..2762f1b340ca1 100644 --- a/tests/phpunit/tests/image/resize.php +++ b/tests/phpunit/tests/image/resize.php @@ -12,12 +12,6 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase public function set_up() { parent::set_up(); - - add_filter( 'wp_image_editors', array( $this, 'wp_image_editors' ) ); - } - - public function wp_image_editors() { - return array( $this->editor_engine ); } public function test_resize_jpg() { From 875722edb7dc4a5086a477a963344f38c54f28e5 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 16 Sep 2025 13:53:17 -0400 Subject: [PATCH 2/9] Confirm proper GD AVIF support in Docker images --- docker-compose.yml | 4 ++-- tests/phpunit/tests/image/resize.php | 12 ++++++++---- tests/phpunit/tests/media.php | 4 ---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 863cbd2ea9b1b..2add116a90234 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: # The PHP container. ## php: - image: wordpressdevelop/php:${LOCAL_PHP-latest} + image: ghcr.io/wordpress/wpdev-docker-images/php:${LOCAL_PHP-latest}-189 networks: - wpdevnet @@ -95,7 +95,7 @@ services: # The WP CLI container. ## cli: - image: wordpressdevelop/cli:${LOCAL_PHP-latest} + image: ghcr.io/wordpress/wpdev-docker-images/cli:${LOCAL_PHP-latest}-189 networks: - wpdevnet diff --git a/tests/phpunit/tests/image/resize.php b/tests/phpunit/tests/image/resize.php index 1c7e65bff222f..8d08ddc2f5dbb 100644 --- a/tests/phpunit/tests/image/resize.php +++ b/tests/phpunit/tests/image/resize.php @@ -87,15 +87,19 @@ public function test_resize_webp() { * Test resizing AVIF image. * * @ticket 51228 - * - * Temporarily disabled until we can figure out why it fails on the Trixie based PHP container. - * See https://core.trac.wordpress.org/ticket/63932. - * @requires PHP < 8.3 */ public function test_resize_avif() { $file = DIR_TESTDATA . '/images/avif-lossy.avif'; $editor = wp_get_image_editor( $file ); + if ( 'WP_Image_Editor_Imagick' == $this->editor_engine ) { + $version = Imagick::getVersion(); + + if ( $version['versionNumber'] >= 0x700 ) { + $this->markTestSkipped( 'ImageMagick 7 is unable to perform this test at this time.' ); + } + } + // Check if the editor supports the avif mime type. if ( is_wp_error( $editor ) || ! $editor->supports_mime_type( 'image/avif' ) ) { $this->markTestSkipped( sprintf( 'No AVIF support in the editor engine %s on this system.', $this->editor_engine ) ); diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index b43869420dedb..7c98cefcce45a 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -5472,10 +5472,6 @@ public function test_quality_with_image_conversion_file_sizes() { * Test AVIF quality filters. * * @ticket 61614 - * - * Temporarily disabled until we can figure out why it fails on the Trixie based PHP container. - * See https://core.trac.wordpress.org/ticket/63932. - * @requires PHP < 8.3 */ public function test_quality_with_avif_conversion_file_sizes() { $temp_dir = get_temp_dir(); From 1bf3108765e2f7bb25d5ce52297595d1b1b95f42 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 16 Sep 2025 13:56:54 -0400 Subject: [PATCH 3/9] Use a strict comparison --- tests/phpunit/tests/image/resize.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/image/resize.php b/tests/phpunit/tests/image/resize.php index 8d08ddc2f5dbb..eb9192d4a161b 100644 --- a/tests/phpunit/tests/image/resize.php +++ b/tests/phpunit/tests/image/resize.php @@ -92,7 +92,7 @@ public function test_resize_avif() { $file = DIR_TESTDATA . '/images/avif-lossy.avif'; $editor = wp_get_image_editor( $file ); - if ( 'WP_Image_Editor_Imagick' == $this->editor_engine ) { + if ( 'WP_Image_Editor_Imagick' === $this->editor_engine ) { $version = Imagick::getVersion(); if ( $version['versionNumber'] >= 0x700 ) { From a9eaf063493f74861492abd96abac848b500cf09 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 16 Sep 2025 20:56:16 -0400 Subject: [PATCH 4/9] Remove `--quiet-pull` to debug --- tools/local-env/scripts/start.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index b0389b2fb0a7f..ed7d49670ed98 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -41,7 +41,6 @@ spawnSync( 'compose', ...composeFiles.map( ( composeFile ) => [ '-f', composeFile ] ).flat(), 'up', - '--quiet-pull', '-d', ...containers, ], From 7d47d33344e6d0d02fa0be11886cc6429e05bfce Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 16 Sep 2025 21:04:56 -0400 Subject: [PATCH 5/9] Re-add PHP constraint --- tests/phpunit/tests/media.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 7c98cefcce45a..b43869420dedb 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -5472,6 +5472,10 @@ public function test_quality_with_image_conversion_file_sizes() { * Test AVIF quality filters. * * @ticket 61614 + * + * Temporarily disabled until we can figure out why it fails on the Trixie based PHP container. + * See https://core.trac.wordpress.org/ticket/63932. + * @requires PHP < 8.3 */ public function test_quality_with_avif_conversion_file_sizes() { $temp_dir = get_temp_dir(); From 44b167729d5c2004113687f6f51c8e183252a2bf Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 16 Sep 2025 21:08:51 -0400 Subject: [PATCH 6/9] Revert `--quiet-pull` debug change --- tools/local-env/scripts/start.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index ed7d49670ed98..b0389b2fb0a7f 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -41,6 +41,7 @@ spawnSync( 'compose', ...composeFiles.map( ( composeFile ) => [ '-f', composeFile ] ).flat(), 'up', + '--quiet-pull', '-d', ...containers, ], From 12f04a2033b3b260ca8ba67c651766b71dfb1c46 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 16 Sep 2025 21:46:23 -0400 Subject: [PATCH 7/9] Try pulling containers --- .github/workflows/reusable-phpunit-tests-v3.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index fd4b83fdd4807..02ab08fb7eb2b 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -178,6 +178,10 @@ jobs: run: | docker -v + - name: Pull Docker containers + run: | + npm run env:pull + - name: Start Docker environment run: | npm run env:start From 45c6b7852d00b1182fe983006daec09f9158b1ab Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 16 Sep 2025 22:01:53 -0400 Subject: [PATCH 8/9] Skip tests for GD on PHP < 8.1 --- tests/phpunit/tests/image/resize.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/phpunit/tests/image/resize.php b/tests/phpunit/tests/image/resize.php index eb9192d4a161b..6bbf4a2260e69 100644 --- a/tests/phpunit/tests/image/resize.php +++ b/tests/phpunit/tests/image/resize.php @@ -92,6 +92,10 @@ public function test_resize_avif() { $file = DIR_TESTDATA . '/images/avif-lossy.avif'; $editor = wp_get_image_editor( $file ); + if ( 'WP_Image_Editor_GD' === $this->editor_engine && PHP_VERSION < 80100 ) { + $this->markTestSkipped( 'AVIF is only supported in GD with PHP >= 8.1.' ); + } + if ( 'WP_Image_Editor_Imagick' === $this->editor_engine ) { $version = Imagick::getVersion(); From b6aab611e465b8a28d7eaf7ec396aceb8951dc65 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 16 Sep 2025 22:39:42 -0400 Subject: [PATCH 9/9] Remove debug container pull --- .github/workflows/reusable-phpunit-tests-v3.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 02ab08fb7eb2b..fd4b83fdd4807 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -178,10 +178,6 @@ jobs: run: | docker -v - - name: Pull Docker containers - run: | - npm run env:pull - - name: Start Docker environment run: | npm run env:start