1--TEST--
2finfo_file(): Testing mime types
3--EXTENSIONS--
4fileinfo
5--FILE--
6<?php
7
8$fp = finfo_open(FILEINFO_MIME_TYPE);
9$results = array();
10
11foreach (glob(__DIR__ . "/resources/*") as $filename) {
12    if (is_file($filename)) {
13        $results["$filename"] = finfo_file($fp, $filename);
14    }
15}
16ksort($results);
17
18var_dump($results);
19?>
20--EXPECTF--
21array(%d) {
22  ["%s/resources/dir.zip"]=>
23  string(15) "application/zip"
24  ["%s/resources/test.awk"]=>
25  string(10) "text/plain"
26  ["%s/resources/test.bmp"]=>
27  string(9) "image/bmp"
28  ["%s/resources/test.gif"]=>
29  string(9) "image/gif"
30  ["%s/resources/test.jpg"]=>
31  string(10) "image/jpeg"
32  ["%s/test.json"]=>
33  string(16) "application/json"
34  ["%s/resources/test.mp3"]=>
35  string(10) "audio/mpeg"
36  ["%s/resources/test.pdf"]=>
37  string(15) "application/pdf"
38  ["%s/resources/test.png"]=>
39  string(9) "image/png"
40  ["%s/resources/test.ppt"]=>
41  string(29) "application/vnd.ms-powerpoint"
42  ["%s/resources/test.tga"]=>
43  string(11) "image/x-tga"
44  ["%s/resources/test.webm"]=>
45  string(10) "video/webm"
46  ["%s/resources/test.woff"]=>
47  string(9) "font/woff"
48  ["%s/resources/test.xz"]=>
49  string(16) "application/x-xz"
50}
51