Make WordPress Core

Changeset 60745


Ignore:
Timestamp:
09/15/2025 07:17:52 PM (2 months ago)
Author:
desrosj
Message:

Build/Test Tools: Fix tooling and PHPUnit test issues.

This fixes the PHPUnit test suite for the 6.7 branch by:

  • Fixing issues with the env:install script when using newer PHP images.
  • Temporarily disables failing tests with ImageMagick 7 is in use.

Backports [60735] and [60736] to the 6.7 branch.

See #63876, #63932.

Location:
branches/6.7
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/6.7

  • branches/6.7/tests/phpunit/tests/image/editorImagick.php

    r56559 r60745  
    657657        }
    658658
     659        $version = Imagick::getVersion();
     660        if ( $version['versionNumber'] < 0x675 ) {
     661            $this->markTestSkipped( 'The version of ImageMagick does not support removing alpha channels from PDFs.' );
     662        }
     663
    659664        $test_file     = DIR_TESTDATA . '/images/test-alpha.pdf';
    660665        $attachment_id = $this->factory->attachment->create_upload_object( $test_file );
  • branches/6.7/tests/phpunit/tests/image/resize.php

    r58849 r60745  
    2424        $image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 25, 25 );
    2525
     26        $this->assertNotWPError( $image );
     27
    2628        list( $w, $h, $type ) = getimagesize( $image );
    2729
     
    7981        $image = $this->resize_helper( $file, 25, 25 );
    8082
     83        $this->assertNotWPError( $image );
     84
    8185        list( $w, $h, $type ) = wp_getimagesize( $image );
    8286
     
    9397     *
    9498     * @ticket 51228
     99     *
     100     * Temporarily disabled until we can figure out why it fails on the Trixie based PHP container.
     101     * See https://core.trac.wordpress.org/ticket/63932.
     102     * @requires PHP < 8.3
    95103     */
    96104    public function test_resize_avif() {
     
    105113        $image = $this->resize_helper( $file, 25, 25 );
    106114
     115        $this->assertNotWPError( $image );
     116
    107117        list( $w, $h, $type ) = wp_getimagesize( $image );
    108118
     
    131141        $image = $this->resize_helper( $file, 25, 25 );
    132142
     143        $this->assertNotWPError( $image );
     144
    133145        list( $w, $h, $type ) = wp_getimagesize( $image );
    134146
     
    152164        $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 96 );
    153165
     166        $this->assertNotWPError( $image );
     167
    154168        list( $w, $h, $type ) = getimagesize( $image );
    155169
     
    165179        $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 0 );
    166180
     181        $this->assertNotWPError( $image );
     182
    167183        list( $w, $h, $type ) = getimagesize( $image );
    168184
     
    178194        $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 0, 96 );
    179195
     196        $this->assertNotWPError( $image );
     197
    180198        list( $w, $h, $type ) = getimagesize( $image );
    181199
     
    191209        $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 150, true );
    192210
     211        $this->assertNotWPError( $image );
     212
    193213        list( $w, $h, $type ) = getimagesize( $image );
    194214
     
    217237        $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 50, 150, true );
    218238
     239        $this->assertNotWPError( $image );
     240
    219241        list( $w, $h, $type ) = getimagesize( $image );
    220242
     
    241263    /**
    242264     * Function to help out the tests
     265     *
     266     * @return string|WP_Error The path to the resized image file or a WP_Error on failure.
    243267     */
    244268    protected function resize_helper( $file, $width, $height, $crop = false ) {
  • branches/6.7/tests/phpunit/tests/media.php

    r59435 r60745  
    53865386        // Sub-sizes: for each size, the JPEGs should be smaller than the WebP.
    53875387        $sizes_to_compare = array_intersect_key( $jpeg_sizes['sizes'], $webp_sizes['sizes'] );
     5388
     5389        $this->assertNotWPError( $sizes_to_compare );
     5390
    53885391        foreach ( $sizes_to_compare as $size => $size_data ) {
    53895392            $this->assertLessThan( $webp_sizes['sizes'][ $size ]['filesize'], $jpeg_sizes['sizes'][ $size ]['filesize'] );
     
    54285431        // Sub-sizes: for each size, the AVIF should be smaller than the JPEG.
    54295432        $sizes_to_compare = array_intersect_key( $avif_sizes['sizes'], $smaller_avif_sizes['sizes'] );
     5433
     5434        $this->assertNotWPError( $sizes_to_compare );
    54305435
    54315436        foreach ( $sizes_to_compare as $size => $size_data ) {
  • branches/6.7/tools/local-env/scripts/install.js

    r59309 r60745  
    4343wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
    4444    .then( () => {
    45         wp_cli( 'db reset --yes' );
     45        wp_cli( 'db reset --yes --defaults' );
    4646        const installCommand = process.env.LOCAL_MULTISITE === 'true'  ? 'multisite-install' : 'install';
    4747        wp_cli( `core ${ installCommand } --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` );
Note: See TracChangeset for help on using the changeset viewer.