Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -5879,7 +5879,7 @@ function _wp_add_additional_image_sizes() {
function wp_show_heic_upload_error( $plupload_settings ) {
// Check if HEIC images can be edited.
if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/heic' ) ) ) {
$plupload_init['heic_upload_error'] = true;
$plupload_settings['heic_upload_error'] = true;
}
return $plupload_settings;
}
Expand Down
25 changes: 25 additions & 0 deletions tests/phpunit/tests/media/wpShowHeicUploadError.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/**
* Tests for the `wp_show_heic_upload_error()` function.
*
* @group media
* @covers ::wp_show_heic_upload_error
*/
class Tests_Media_wpShowHeicUploadError extends WP_UnitTestCase {

/**
* @ticket 65802
*/
public function test_adds_error_flag_to_the_given_settings_when_heic_is_not_editable() {
add_filter( 'wp_image_editors', '__return_empty_array' );

$this->assertSame(
array(
'existing' => 'value',
'heic_upload_error' => true,
),
wp_show_heic_upload_error( array( 'existing' => 'value' ) )
);
}
}
Loading