Patch finfo_file_regex.patch.txt for Testing related Bug #62177
Patch version 2012-05-29 01:24 UTC
Return to Bug #62177 |
Download this patch
Patch Revisions:
Developer: mattficken
--- a/ext/fileinfo/tests/finfo_file_regex.phpt Fri May 25 01:50:50 2012
+++ b/ext/fileinfo/tests/finfo_file_regex.phpt Mon May 28 17:48:24 2012
@@ -1,7 +1,11 @@
--TEST--
Test finfo_file() function : regex rules
--SKIPIF--
-<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+<?php require_once(dirname(__FILE__) . '/skipif.inc');
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Non Windows Systems');
+}
+?>
--FILE--
<?php
/**
+++ b/ext/fileinfo/tests/finfo_file_regex-win32.phpt Mon May 28 17:48:24 2012
+--TEST--
+Test finfo_file() function : regex rules
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc');
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/**
+ * Works with the unix file command:
+ * $ file -m magic resources/test.awk
+ * resources/test.awk: awk script, ASCII text
+ */
+$magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
+$finfo = finfo_open( FILEINFO_MIME, $magicFile );
+
+echo "*** Testing finfo_file() : regex rules ***\n";
+
+// Calling finfo_file() with all possible arguments
+$file = __DIR__ . '/resources/test.awk';
+var_dump( finfo_file( $finfo, $file ) );
+var_dump( finfo_file( $finfo, $file, FILEINFO_CONTINUE ) );
+
+// Windows uses libfileinfo 1.0.5-dev
+// this may be causing the slightly different output from the first
+// finfo_file() call
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing finfo_file() : regex rules ***
+string(10) "text/plain"
+string(22) "awk script, ASCII text"
+===DONE===
|