Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/local-docker-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-24.04 ]
memcached: [ false ]
memcached: [ false, true ]
php: ${{ fromJSON( needs.build-test-matrix.outputs.php-versions ) }}
db-version: ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
strategy:
fail-fast: false
matrix:
memcached: [ false ]
memcached: [ false, true ]
multisite: [ true, false ]
subject: ${{ fromJson( needs.determine-matrix.outputs.subjects ) }}
with:
Expand All @@ -119,7 +119,7 @@ jobs:
strategy:
fail-fast: false
matrix:
memcached: [ false ]
memcached: [ false, true ]
multisite: [ true, false ]
# A matrix value is needed in the 'name' directive for proper grouping in the GitHub UI.
label: [ Compare ]
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/reusable-end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ jobs:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false

- name: Create a Docker override file
if: ${{ contains( fromJSON('["8.3", "8.4"]'), inputs.php-version ) }}
env:
PHP_VERSION: ${{ inputs.php-version }}
run: cp "tools/local-env/php-$PHP_VERSION-docker-compose.override.yml" docker-compose.override.yml

- name: Set up Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/reusable-performance-test-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ jobs:
fetch-depth: ${{ github.event_name == 'workflow_dispatch' && '2' || '1' }}
persist-credentials: false

- name: Create a Docker override file
if: ${{ contains( fromJSON('["8.3", "8.4"]'), inputs.php-version ) }}
env:
PHP_VERSION: ${{ inputs.php-version }}
run: cp "tools/local-env/php-$PHP_VERSION-docker-compose.override.yml" docker-compose.override.yml

- name: Set up Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/reusable-phpunit-tests-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ jobs:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false

- name: Create a Docker override file
if: ${{ contains( fromJSON('["8.3", "8.4"]'), inputs.php ) }}
env:
PHP_VERSION: ${{ inputs.php }}
run: cp "tools/local-env/php-${{ env.PHP_VERSION }}-docker-compose.override.yml" docker-compose.override.yml

- name: Set up Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ jobs:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false

- name: Create a Docker override file
if: ${{ contains( fromJSON('["8.3", "8.4"]'), inputs.php ) }}
env:
PHP_VERSION: ${{ inputs.php }}
run: cp "tools/local-env/php-$PHP_VERSION-docker-compose.override.yml" docker-compose.override.yml

- name: Set up Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ services:

volumes:
- ./:/var/www
- ./tools/local-env/mysql-client.cnf:/etc/mysql/conf.d/no-ssl.cnf:ro

# Keeps the service alive.
command: 'sleep infinity'
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
convertNoticesToExceptions="true"
Expand Down
20 changes: 20 additions & 0 deletions tests/phpunit/tests/image/editorImagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,10 @@ static function ( $value ) {
* Test filter `image_max_bit_depth` correctly sets the maximum bit depth of resized images.
*
* @ticket 62285
*
* 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting that this will eventually need to be changed to PHP < 8.1 should a security update be released for 8.1 & 8.2.

I think referencing the ticket is OK for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to do this in the test where we can check the imagemagick version using Imagick::getVersion()? I don't have a strong opinion but it should make the concern about future containers go away

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is suggested over in #9775

*/
public function test_image_max_bit_depth() {
$file = DIR_TESTDATA . '/images/colors_hdr_p3.avif';
Expand Down Expand Up @@ -775,6 +779,14 @@ public function __return_eight() {
*/
public function test_resizes_are_small_for_16bit_images( $file ) {

// Temporarily disabled. See https://core.trac.wordpress.org/ticket/63932.
if ( DIR_TESTDATA . '/images/png-tests/test8.png' === $file ) {
$version = Imagick::getVersion();
if ( $version['versionNumber'] >= 0x700 ) {
$this->markTestSkipped( 'ImageMagick 7 is unable to optimize grayscale images with 1-bit transparency.' );
}
}

$temp_file = DIR_TESTDATA . '/images/test-temp.png';

$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
Expand Down Expand Up @@ -831,6 +843,14 @@ public static function data_resizes_are_small_for_16bit_images() {
*/
public function test_png_color_type_is_preserved_after_resize( $file_path, $expected_color_type ) {

// Temporarily disabled. See https://core.trac.wordpress.org/ticket/63932.
if ( DIR_TESTDATA . '/images/png-tests/test8.png' === $file_path ) {
$version = Imagick::getVersion();
if ( $version['versionNumber'] >= 0x700 ) {
$this->markTestSkipped( 'ImageMagick 7 is unable to optimize grayscale images with 1-bit transparency.' );
}
}

$temp_file = DIR_TESTDATA . '/images/test-temp.png';

$imagick_image_editor = new WP_Image_Editor_Imagick( $file_path );
Expand Down
26 changes: 26 additions & 0 deletions tests/phpunit/tests/image/resize.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public function wp_image_editors() {
public function test_resize_jpg() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 25, 25 );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = getimagesize( $image );

unlink( $image );
Expand Down Expand Up @@ -78,6 +80,8 @@ public function test_resize_webp() {

$image = $this->resize_helper( $file, 25, 25 );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = wp_getimagesize( $image );

unlink( $image );
Expand All @@ -92,6 +96,10 @@ 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';
Expand All @@ -104,6 +112,8 @@ public function test_resize_avif() {

$image = $this->resize_helper( $file, 25, 25 );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = wp_getimagesize( $image );

unlink( $image );
Expand All @@ -130,6 +140,8 @@ public function test_resize_heic() {

$image = $this->resize_helper( $file, 25, 25 );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = wp_getimagesize( $image );

unlink( $image );
Expand All @@ -151,6 +163,8 @@ public function test_resize_larger() {
public function test_resize_thumb_128x96() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 96 );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = getimagesize( $image );

unlink( $image );
Expand All @@ -164,6 +178,8 @@ public function test_resize_thumb_128x96() {
public function test_resize_thumb_128x0() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 0 );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = getimagesize( $image );

unlink( $image );
Expand All @@ -177,6 +193,8 @@ public function test_resize_thumb_128x0() {
public function test_resize_thumb_0x96() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 0, 96 );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = getimagesize( $image );

unlink( $image );
Expand All @@ -190,6 +208,8 @@ public function test_resize_thumb_0x96() {
public function test_resize_thumb_150x150_crop() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 150, true );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = getimagesize( $image );

unlink( $image );
Expand All @@ -203,6 +223,8 @@ public function test_resize_thumb_150x150_crop() {
public function test_resize_thumb_150x100_crop() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 100, true );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = getimagesize( $image );

unlink( $image );
Expand All @@ -216,6 +238,8 @@ public function test_resize_thumb_150x100_crop() {
public function test_resize_thumb_50x150_crop() {
$image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 50, 150, true );

$this->assertNotWPError( $image );

list( $w, $h, $type ) = getimagesize( $image );

unlink( $image );
Expand All @@ -240,6 +264,8 @@ public function test_resize_non_existent_image() {

/**
* Function to help out the tests
*
* @return string|WP_Error The path to the resized image file or a WP_Error on failure.
*/
protected function resize_helper( $file, $width, $height, $crop = false ) {
$editor = wp_get_image_editor( $file );
Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/tests/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -5460,6 +5460,9 @@ public function test_quality_with_image_conversion_file_sizes() {

// Sub-sizes: for each size, the JPEGs should be smaller than the WebP.
$sizes_to_compare = array_intersect_key( $jpeg_sizes['sizes'], $webp_sizes['sizes'] );

$this->assertNotEmpty( $sizes_to_compare );

foreach ( $sizes_to_compare as $size => $size_data ) {
$this->assertLessThan( $webp_sizes['sizes'][ $size ]['filesize'], $jpeg_sizes['sizes'][ $size ]['filesize'] );
}
Expand All @@ -5469,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();
Expand Down Expand Up @@ -5503,6 +5510,8 @@ public function test_quality_with_avif_conversion_file_sizes() {
// Sub-sizes: for each size, the AVIF should be smaller than the JPEG.
$sizes_to_compare = array_intersect_key( $avif_sizes['sizes'], $smaller_avif_sizes['sizes'] );

$this->assertNotEmpty( $sizes_to_compare );

foreach ( $sizes_to_compare as $size => $size_data ) {
$this->assertLessThan( $avif_sizes['sizes'][ $size ]['filesize'], $smaller_avif_sizes['sizes'][ $size ]['filesize'] );
}
Expand Down
2 changes: 2 additions & 0 deletions tools/local-env/mysql-client.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[client]
ssl=0
16 changes: 0 additions & 16 deletions tools/local-env/php-8.3-docker-compose.override.yml

This file was deleted.

16 changes: 0 additions & 16 deletions tools/local-env/php-8.4-docker-compose.override.yml

This file was deleted.

2 changes: 1 addition & 1 deletion tools/local-env/scripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ wait_on( {
process.exit( 1 );
} )
.then( () => {
wp_cli( 'db reset --yes' );
wp_cli( 'db reset --yes --defaults' );
const installCommand = process.env.LOCAL_MULTISITE === 'true' ? 'multisite-install' : 'install';
wp_cli( `core ${ installCommand } --title="WordPress Develop" --admin_user=admin --admin_password=password [email protected] --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` );
} )
Expand Down
Loading