php-src/ext/fileinfo/tests/finfo_file_002.phpt

45 lines
1.0 KiB
Plaintext
Raw Normal View History

2008-08-29 09:52:13 +00:00
--TEST--
finfo_file(): Testing mime types
2009-03-15 23:17:28 +00:00
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
2008-08-29 09:52:13 +00:00
--FILE--
<?php
$fp = finfo_open(FILEINFO_MIME_TYPE);
2008-08-29 09:52:13 +00:00
$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(%d) {
["%s/resources/dir.zip"]=>
string(15) "application/zip"
2012-05-24 16:42:47 +00:00
["%s/resources/test.awk"]=>
string(10) "text/plain"
2008-08-29 09:52:13 +00:00
["%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.mp3"]=>
string(10) "audio/mpeg"
2008-08-29 09:52:13 +00:00
["%s/resources/test.pdf"]=>
string(15) "application/pdf"
["%s/resources/test.png"]=>
string(9) "image/png"
["%s/resources/test.ppt"]=>
2019-06-29 11:30:35 +00:00
string(29) "application/vnd.ms-powerpoint"
2019-06-29 09:59:08 +00:00
["%s/resources/test.tga"]=>
string(11) "image/x-tga"
["%s/resources/test.webm"]=>
string(10) "video/webm"
2008-08-29 09:52:13 +00:00
}