Make WordPress Core

Changeset 49044


Ignore:
Timestamp:
09/25/2020 01:29:51 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Check if image sizes were successfully retrieved in some REST API attachments controller tests.

This outputs a proper message in case of failure, instead of an obscure PHP error further in the test.

Props TimothyBlynJacobs.
See #50913, #51393.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r48939 r49044  
    605605        remove_image_size( 'rest-api-test' );
    606606
     607        $this->assertNotEmpty( $data['media_details']['sizes'] );
    607608        $this->assertSame( $image_src[0], $data['media_details']['sizes']['rest-api-test']['source_url'] );
    608609        $this->assertSame( 'image/jpeg', $data['media_details']['sizes']['rest-api-test']['mime_type'] );
     
    633634        remove_image_size( 'rest-api-test' );
    634635
     636        $this->assertNotEmpty( $data['media_details']['sizes'] );
    635637        $this->assertFalse( isset( $data['media_details']['sizes']['rest-api-test']['source_url'] ) );
    636638    }
Note: See TracChangeset for help on using the changeset viewer.