Make WordPress Core

Changeset 53532


Ignore:
Timestamp:
06/19/2022 05:26:52 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Consistently check that an image was loaded in image saving tests.

Don't unnecessarily load the image twice in test_inferred_mime_types_when_saving_an_image().

Follow-up to [1061/tests], [1151/tests], [1157/tests], [29834].

See #55652.

File:
1 edited

Legend:

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

    r53531 r53532  
    258258        $loaded = $img->load();
    259259
     260        $this->assertNotWPError( $loaded, 'Image failed to load - WP_Error returned' );
     261
    260262        if ( ! $img->supports_mime_type( $mime_type ) ) {
    261263            $this->markTestSkipped(
     
    333335        $loaded = $img->load();
    334336
     337        $this->assertNotWPError( $loaded, 'Image failed to load - WP_Error returned' );
     338
    335339        // Save the file.
    336340        $mime_type = 'image/gif';
     
    376380        $loaded = $img->load();
    377381
    378         $img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
    379         $this->assertNotWPError( $img );
     382        $this->assertNotWPError( $loaded, 'Image failed to load - WP_Error returned' );
    380383
    381384        if ( ! $img->supports_mime_type( $mime_type ) ) {
Note: See TracChangeset for help on using the changeset viewer.