scottmac Fri Aug 29 09:55:52 2008 UTC
Modified files:
/php-src/ext/fileinfo/tests finfo_file_002.phpt
/php-src/ext/fileinfo/tests/resources test.bmp test.gif test.jpg
test.pdf test.png
Log:
MFB: Test for fileinfo to check mime types.
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/finfo_file_002.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/fileinfo/tests/finfo_file_002.phpt
diff -u /dev/null php-src/ext/fileinfo/tests/finfo_file_002.phpt:1.2
--- /dev/null Fri Aug 29 09:55:52 2008
+++ php-src/ext/fileinfo/tests/finfo_file_002.phpt Fri Aug 29 09:55:52 2008
@@ -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"
+}
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/resources/test.bmp?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/fileinfo/tests/resources/test.bmp
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/resources/test.gif?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/fileinfo/tests/resources/test.gif
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/resources/test.jpg?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/fileinfo/tests/resources/test.jpg
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/resources/test.pdf?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/fileinfo/tests/resources/test.pdf
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/resources/test.png?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/fileinfo/tests/resources/test.png
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php