finfo_upstream.phpt 614 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Fileinfo run upstream tests
  3. --EXTENSIONS--
  4. fileinfo
  5. --ENV--
  6. TZ=UTC
  7. --FILE--
  8. <?php
  9. $lst = glob(__DIR__ . DIRECTORY_SEPARATOR . "upstream/*.testfile");
  10. foreach($lst as $p) {
  11. $mp = dirname($p) . DIRECTORY_SEPARATOR . basename($p, ".testfile") . ".magic";
  12. $tp = dirname($p) . DIRECTORY_SEPARATOR . basename($p, ".testfile") . ".result";
  13. $finfo = finfo_open(FILEINFO_NONE, file_exists($mp) ? $mp : NULL);
  14. $i = finfo_file( $finfo, $p);
  15. $exp = file_get_contents($tp);
  16. if ($i !== $exp) {
  17. echo "'$p' failed\nexp: '$exp'\ngot: '$i'\n";
  18. }
  19. finfo_close($finfo);
  20. }
  21. echo "==DONE==";
  22. ?>
  23. --EXPECT--
  24. ==DONE==