Make WordPress Core

Changeset 64318


Ignore:
Timestamp:
10/12/2026 08:50:38 PM (12 hours ago)
Author:
lancewillett
Message:

Tests: Skip PDF alpha checks when the fixture cannot load.

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: ​https://github.com/WordPress/wordpress-develop/pull/14214

Props ekamran.
See #65819.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/image/editorImagick.php

    r61396 r64318  
    666666                }
    667667
    668                 $test_file     = DIR_TESTDATA . '/images/test-alpha.pdf';
     668                $test_file = DIR_TESTDATA . '/images/test-alpha.pdf';
     669
     670                $editor = wp_get_image_editor( $test_file );
     671                if ( is_wp_error( $editor ) ) {
     672                        $this->markTestSkipped( $editor->get_error_message() );
     673                }
     674
    669675                $attachment_id = $this->factory->attachment->create_upload_object( $test_file );
    670676                $this->assertNotEmpty( $attachment_id, 'The attachment was not created before testing.' );
Note: See TracChangeset for help on using the changeset viewer.