Make WordPress Core


Ignore:
Timestamp:
09/20/2020 02:45:35 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Skip some image tests if neither GD nor Imagick image editor engines are supported on the system.

The explicit message brings some consistency with other image editor tests, specifically the ones using the WP_Image_UnitTestCase class.

Previously, the tests were marked as "risky" in that scenario, due to performing no assertions.

See #50639, #50640.

File:
1 edited

Legend:

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

    r48937 r49009  
    156156        }
    157157
     158        if ( ! WP_Image_Editor_GD::test() && ! WP_Image_Editor_Imagick::test() ) {
     159            $this->markTestSkipped( sprintf( 'The image editor engine %s is not supported on this system.', 'WP_Image_Editor_GD' ) );
     160        }
     161
    158162        require_once ABSPATH . 'wp-admin/includes/image-edit.php';
    159163
     
    209213        }
    210214
     215        if ( ! WP_Image_Editor_GD::test() && ! WP_Image_Editor_Imagick::test() ) {
     216            $this->markTestSkipped( sprintf( 'The image editor engine %s is not supported on this system.', 'WP_Image_Editor_GD' ) );
     217        }
     218
    211219        // Test each image editor engine.
    212220        $classes = array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
     
    246254        if ( ! extension_loaded( 'fileinfo' ) ) {
    247255            $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
     256        }
     257
     258        if ( ! WP_Image_Editor_GD::test() && ! WP_Image_Editor_Imagick::test() ) {
     259            $this->markTestSkipped( sprintf( 'The image editor engine %s is not supported on this system.', 'WP_Image_Editor_GD' ) );
    248260        }
    249261
     
    307319        $editor2 = wp_get_image_editor( DIR_TESTDATA );
    308320        $this->assertNotInternalType( 'resource', $editor2 );
     321
     322        if ( ! WP_Image_Editor_GD::test() && ! WP_Image_Editor_Imagick::test() ) {
     323            $this->markTestSkipped( sprintf( 'The image editor engine %s is not supported on this system.', 'WP_Image_Editor_GD' ) );
     324        }
    309325
    310326        // Then, test with editors.
     
    511527     */
    512528    public function test_crop_setting_for_pdf() {
    513 
    514529        if ( ! wp_image_editor_supports( array( 'mime_type' => 'application/pdf' ) ) ) {
    515530            $this->markTestSkipped( 'Rendering PDFs is not supported on this system.' );
Note: See TracChangeset for help on using the changeset viewer.