2008-08-29 09:55:52 +00:00
|
|
|
--TEST--
|
|
|
|
finfo_file(): Testing mime types
|
2009-03-15 23:16:55 +00:00
|
|
|
--SKIPIF--
|
|
|
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
2008-08-29 09:55:52 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
2009-03-15 23:02:35 +00:00
|
|
|
$fp = finfo_open(FILEINFO_MIME_TYPE);
|
2008-08-29 09:55:52 +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(5) {
|
2008-08-29 10:34:34 +00:00
|
|
|
[u"%s/resources/test.bmp"]=>
|
2008-08-29 09:55:52 +00:00
|
|
|
string(14) "image/x-ms-bmp"
|
2008-08-29 10:34:34 +00:00
|
|
|
[u"%s/resources/test.gif"]=>
|
2008-08-29 09:55:52 +00:00
|
|
|
string(9) "image/gif"
|
2008-08-29 10:34:34 +00:00
|
|
|
[u"%s/resources/test.jpg"]=>
|
2008-08-29 09:55:52 +00:00
|
|
|
string(10) "image/jpeg"
|
2008-08-29 10:34:34 +00:00
|
|
|
[u"%s/resources/test.pdf"]=>
|
2008-08-29 09:55:52 +00:00
|
|
|
string(15) "application/pdf"
|
2008-08-29 10:34:34 +00:00
|
|
|
[u"%s/resources/test.png"]=>
|
2008-08-29 09:55:52 +00:00
|
|
|
string(9) "image/png"
|
|
|
|
}
|