|
@@ 940-959 (lines=20) @@
|
| 937 |
|
* @ticket 39550 |
| 938 |
|
* @group ms-excluded |
| 939 |
|
*/ |
| 940 |
|
function test_wp_check_filetype_and_ext_with_filtered_svg() { |
| 941 |
|
if ( ! extension_loaded( 'fileinfo' ) ) { |
| 942 |
|
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' ); |
| 943 |
|
} |
| 944 |
|
|
| 945 |
|
$file = DIR_TESTDATA . '/uploads/video-play.svg'; |
| 946 |
|
$filename = 'video-play.svg'; |
| 947 |
|
|
| 948 |
|
$expected = array( |
| 949 |
|
'ext' => 'svg', |
| 950 |
|
'type' => 'image/svg+xml', |
| 951 |
|
'proper_filename' => false, |
| 952 |
|
); |
| 953 |
|
|
| 954 |
|
add_filter( 'upload_mimes', array( $this, '_filter_mime_types_svg' ) ); |
| 955 |
|
$this->assertEquals( $expected, wp_check_filetype_and_ext( $file, $filename ) ); |
| 956 |
|
|
| 957 |
|
// Cleanup. |
| 958 |
|
remove_filter( 'upload_mimes', array( $this, '_test_add_mime_types_svg' ) ); |
| 959 |
|
} |
| 960 |
|
|
| 961 |
|
/** |
| 962 |
|
* @ticket 39550 |
|
@@ 965-984 (lines=20) @@
|
| 962 |
|
* @ticket 39550 |
| 963 |
|
* @group ms-excluded |
| 964 |
|
*/ |
| 965 |
|
function test_wp_check_filetype_and_ext_with_filtered_woff() { |
| 966 |
|
if ( ! extension_loaded( 'fileinfo' ) ) { |
| 967 |
|
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' ); |
| 968 |
|
} |
| 969 |
|
|
| 970 |
|
$file = DIR_TESTDATA . '/uploads/dashicons.woff'; |
| 971 |
|
$filename = 'dashicons.woff'; |
| 972 |
|
|
| 973 |
|
$expected = array( |
| 974 |
|
'ext' => 'woff', |
| 975 |
|
'type' => 'application/font-woff', |
| 976 |
|
'proper_filename' => false, |
| 977 |
|
); |
| 978 |
|
|
| 979 |
|
add_filter( 'upload_mimes', array( $this, '_filter_mime_types_woff' ) ); |
| 980 |
|
$this->assertEquals( $expected, wp_check_filetype_and_ext( $file, $filename ) ); |
| 981 |
|
|
| 982 |
|
// Cleanup. |
| 983 |
|
remove_filter( 'upload_mimes', array( $this, '_test_add_mime_types_woff' ) ); |
| 984 |
|
} |
| 985 |
|
|
| 986 |
|
public function _filter_mime_types_svg( $mimes ) { |
| 987 |
|
$mimes['svg'] = 'image/svg+xml'; |