Skip to content

Commit

Permalink
Add seemingly missing image/webp support checks for PHP 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed May 9, 2024
1 parent 3f28af5 commit 5f6c663
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/plugins/webp-uploads/helper-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ public function it_should_prevent_to_create_an_image_size_when_attached_file_doe
* @test
*/
public function it_should_prevent_to_create_a_subsize_if_the_image_editor_does_not_exists(): void {
if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
$this->markTestSkipped( 'Mime type image/webp is not supported.' );
}

$attachment_id = self::factory()->attachment->create_upload_object(
TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/leaves.jpg'
);
Expand Down Expand Up @@ -269,6 +273,10 @@ static function () {
* @test
*/
public function it_should_create_an_image_with_filter_webp_uploads_pre_generate_additional_image_source(): void {
if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
$this->markTestSkipped( 'Mime type image/webp is not supported.' );
}

remove_all_filters( 'webp_uploads_pre_generate_additional_image_source' );

$attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/car.jpeg' );
Expand Down

0 comments on commit 5f6c663

Please sign in to comment.