mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
In wp_mime_type_icon(), the length of the $wilds array varies depending on what is passed as $mime. Loop over $wilds instead of arbitrarily checking $wilds[0].
Adds unit tests. Fixes #33012. git-svn-id: https://develop.svn.wordpress.org/trunk@34255 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -512,9 +512,9 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
|
||||
|
||||
$upload = wp_upload_bits( basename( $filename ), null, $contents );
|
||||
|
||||
$this->assertNotEmpty( $upload['error'] );
|
||||
|
||||
remove_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) );
|
||||
|
||||
$this->assertNotEmpty( $upload['error'] );
|
||||
}
|
||||
|
||||
public function whitelist_psd_mime_type( $mimes ) {
|
||||
@@ -526,4 +526,22 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
|
||||
unset( $mimes['jpg|jpeg|jpe'] );
|
||||
return $mimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 33012
|
||||
*/
|
||||
public function test_wp_mime_type_icon() {
|
||||
$icon = wp_mime_type_icon();
|
||||
|
||||
$this->assertContains( 'images/media/default.png', $icon );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 33012
|
||||
*/
|
||||
public function test_wp_mime_type_icon_video() {
|
||||
$icon = wp_mime_type_icon( 'video/mp4' );
|
||||
|
||||
$this->assertContains( 'images/media/video.png', $icon );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user