File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1732,6 +1732,31 @@ public function test_wp_get_attachment_image_url() {
17321732 $ this ->assertSame ( $ image [0 ], wp_get_attachment_image_url ( $ attachment_id ) );
17331733 }
17341734
1735+ /**
1736+ * @ticket 64742
1737+ */
1738+ public function test_wp_get_attachment_image_src_with_icon_when_icon_file_size_cannot_be_read () {
1739+ $ post_id = self ::factory ()->post ->create ();
1740+ $ attachment_id = self ::factory ()->attachment ->create_object (
1741+ 'test.pdf ' ,
1742+ $ post_id ,
1743+ array (
1744+ 'post_mime_type ' => 'application/pdf ' ,
1745+ 'post_type ' => 'attachment ' ,
1746+ )
1747+ );
1748+
1749+ $ filter = static function () {
1750+ return 'https://example.org/wp-includes/images/media/missing-icon.png ' ;
1751+ };
1752+
1753+ add_filter ( 'wp_mime_type_icon ' , $ filter );
1754+
1755+ $ this ->assertFalse ( wp_get_attachment_image_src ( $ attachment_id , 'thumbnail ' , true ) );
1756+
1757+ remove_filter ( 'wp_mime_type_icon ' , $ filter );
1758+ }
1759+
17351760 /**
17361761 * @ticket 12235
17371762 */
You can’t perform that action at this time.
0 commit comments