mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
Test for fileinfo to check mime types.
This commit is contained in:
parent
4690692519
commit
907c24fd81
30
ext/fileinfo/tests/finfo_file_002.phpt
Normal file
30
ext/fileinfo/tests/finfo_file_002.phpt
Normal file
@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
finfo_file(): Testing mime types
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$fp = finfo_open(FILEINFO_MIME);
|
||||
$results = array();
|
||||
|
||||
foreach (glob(__DIR__ . "/resources/*") as $filename) {
|
||||
if (is_file($filename)) {
|
||||
$results["$filename"] = finfo_file($fp, $filename);
|
||||
}
|
||||
}
|
||||
ksort($results);
|
||||
|
||||
var_dump($results);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
["%s/resources/test.bmp"]=>
|
||||
string(14) "image/x-ms-bmp"
|
||||
["%s/resources/test.gif"]=>
|
||||
string(9) "image/gif"
|
||||
["%s/resources/test.jpg"]=>
|
||||
string(10) "image/jpeg"
|
||||
["%s/resources/test.pdf"]=>
|
||||
string(15) "application/pdf"
|
||||
["%s/resources/test.png"]=>
|
||||
string(9) "image/png"
|
||||
}
|
BIN
ext/fileinfo/tests/resources/test.bmp
Normal file
BIN
ext/fileinfo/tests/resources/test.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 B |
BIN
ext/fileinfo/tests/resources/test.gif
Normal file
BIN
ext/fileinfo/tests/resources/test.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 B |
BIN
ext/fileinfo/tests/resources/test.jpg
Normal file
BIN
ext/fileinfo/tests/resources/test.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 160 B |
BIN
ext/fileinfo/tests/resources/test.pdf
Normal file
BIN
ext/fileinfo/tests/resources/test.pdf
Normal file
Binary file not shown.
BIN
ext/fileinfo/tests/resources/test.png
Normal file
BIN
ext/fileinfo/tests/resources/test.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 93 B |
Loading…
Reference in New Issue
Block a user