Skip to content
Open
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
25 changes: 25 additions & 0 deletions tests/phpunit/tests/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,31 @@ public function test_wp_get_attachment_image_url() {
$this->assertSame( $image[0], wp_get_attachment_image_url( $attachment_id ) );
}

/**
* @ticket 64742
*/
public function test_wp_get_attachment_image_src_with_icon_when_icon_file_size_cannot_be_read() {
$post_id = self::factory()->post->create();
$attachment_id = self::factory()->attachment->create_object(
'test.pdf',
$post_id,
array(
'post_mime_type' => 'application/pdf',
'post_type' => 'attachment',
)
);

$filter = static function () {
return 'https://example.org/wp-includes/images/media/missing-icon.png';
};

add_filter( 'wp_mime_type_icon', $filter );

$this->assertFalse( wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) );

remove_filter( 'wp_mime_type_icon', $filter );
}

/**
* @ticket 12235
*/
Expand Down
Loading