diff --git tests/phpunit/tests/functions.php tests/phpunit/tests/functions.php
index e22eb7ed278..a3aba79c448 100644
|
|
|
class Tests_Functions extends WP_UnitTestCase { |
| 931 | 931 | * @ticket 39550 |
| 932 | 932 | */ |
| 933 | 933 | function test_wp_check_filetype_and_ext_with_filtered_svg() { |
| | 934 | if ( ! extension_loaded( 'fileinfo' ) ) { |
| | 935 | $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' ); |
| | 936 | } |
| | 937 | |
| | 938 | if ( is_multisite() ) { |
| | 939 | $this->markTestSkipped( 'Test does not run in multisite' ); |
| | 940 | } |
| | 941 | |
| 934 | 942 | $file = DIR_TESTDATA . '/uploads/video-play.svg'; |
| 935 | 943 | $filename = 'video-play.svg'; |
| 936 | 944 | |
| … |
… |
class Tests_Functions extends WP_UnitTestCase { |
| 951 | 959 | * @ticket 39550 |
| 952 | 960 | */ |
| 953 | 961 | function test_wp_check_filetype_and_ext_with_filtered_woff() { |
| | 962 | if ( ! extension_loaded( 'fileinfo' ) ) { |
| | 963 | $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' ); |
| | 964 | } |
| | 965 | |
| | 966 | if ( is_multisite() ) { |
| | 967 | $this->markTestSkipped( 'Test does not run in multisite' ); |
| | 968 | } |
| | 969 | |
| 954 | 970 | $file = DIR_TESTDATA . '/uploads/dashicons.woff'; |
| 955 | 971 | $filename = 'dashicons.woff'; |
| 956 | 972 | |
| … |
… |
class Tests_Functions extends WP_UnitTestCase { |
| 978 | 994 | } |
| 979 | 995 | |
| 980 | 996 | public function _wp_check_filetype_and_ext_data() { |
| 981 | | return array( |
| | 997 | $data = array( |
| 982 | 998 | // Standard image. |
| 983 | 999 | array( |
| 984 | 1000 | DIR_TESTDATA . '/images/canola.jpg', |
| … |
… |
class Tests_Functions extends WP_UnitTestCase { |
| 1019 | 1035 | 'proper_filename' => false, |
| 1020 | 1036 | ), |
| 1021 | 1037 | ), |
| 1022 | | // Standard non-image file. |
| 1023 | | array( |
| 1024 | | DIR_TESTDATA . '/formatting/big5.txt', |
| 1025 | | 'big5.txt', |
| 1026 | | array( |
| 1027 | | 'ext' => 'txt', |
| 1028 | | 'type' => 'text/plain', |
| 1029 | | 'proper_filename' => false, |
| 1030 | | ), |
| 1031 | | ), |
| 1032 | | // Non-image file with wrong sub-type. |
| 1033 | | array( |
| 1034 | | DIR_TESTDATA . '/uploads/pages-to-word.docx', |
| 1035 | | 'pages-to-word.docx', |
| 1036 | | array( |
| 1037 | | 'ext' => 'docx', |
| 1038 | | 'type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
| 1039 | | 'proper_filename' => false, |
| 1040 | | ), |
| 1041 | | ), |
| 1042 | 1038 | // Non-image file not allowed. |
| 1043 | 1039 | array( |
| 1044 | 1040 | DIR_TESTDATA . '/export/crazy-cdata.xml', |
| … |
… |
class Tests_Functions extends WP_UnitTestCase { |
| 1050 | 1046 | ), |
| 1051 | 1047 | ), |
| 1052 | 1048 | ); |
| | 1049 | |
| | 1050 | // Test a few additional file types on single sites. |
| | 1051 | if ( ! is_multisite() ) { |
| | 1052 | $data = array_merge( $data, array( |
| | 1053 | // Standard non-image file. |
| | 1054 | array( |
| | 1055 | DIR_TESTDATA . '/formatting/big5.txt', |
| | 1056 | 'big5.txt', |
| | 1057 | array( |
| | 1058 | 'ext' => 'txt', |
| | 1059 | 'type' => 'text/plain', |
| | 1060 | 'proper_filename' => false, |
| | 1061 | ), |
| | 1062 | ), |
| | 1063 | // Non-image file with wrong sub-type. |
| | 1064 | array( |
| | 1065 | DIR_TESTDATA . '/uploads/pages-to-word.docx', |
| | 1066 | 'pages-to-word.docx', |
| | 1067 | array( |
| | 1068 | 'ext' => 'docx', |
| | 1069 | 'type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
| | 1070 | 'proper_filename' => false, |
| | 1071 | ), |
| | 1072 | ), |
| | 1073 | ) ); |
| | 1074 | } |
| | 1075 | |
| | 1076 | return $data; |
| 1053 | 1077 | } |
| 1054 | 1078 | } |