finfo_open_basic.phpt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test finfo_open() function : basic functionality
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. /* Prototype : resource finfo_open([int options [, string arg]])
  8. * Description: Create a new fileinfo resource.
  9. * Source code: ext/fileinfo/fileinfo.c
  10. * Alias to functions:
  11. */
  12. $magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
  13. echo "*** Testing finfo_open() : basic functionality ***\n";
  14. // Calling finfo_open() with different options
  15. var_dump( finfo_open( FILEINFO_MIME, $magicFile ) );
  16. var_dump( finfo_open( FILEINFO_NONE, $magicFile ) );
  17. var_dump( finfo_open( FILEINFO_SYMLINK, $magicFile ) );
  18. //var_dump( finfo_open( FILEINFO_COMPRESS, $magicFile ) );
  19. var_dump( finfo_open( FILEINFO_DEVICES, $magicFile ) );
  20. var_dump( finfo_open( FILEINFO_CONTINUE, $magicFile ) );
  21. var_dump( finfo_open( FILEINFO_PRESERVE_ATIME, $magicFile ) );
  22. var_dump( finfo_open( FILEINFO_RAW, $magicFile ) );
  23. // OO inteface to finfo
  24. var_dump( new finfo( FILEINFO_MIME, $magicFile ) );
  25. var_dump( new finfo() );
  26. ?>
  27. ===DONE===
  28. --EXPECTF--
  29. *** Testing finfo_open() : basic functionality ***
  30. resource(%d) of type (file_info)
  31. resource(%d) of type (file_info)
  32. resource(%d) of type (file_info)
  33. resource(%d) of type (file_info)
  34. resource(%d) of type (file_info)
  35. resource(%d) of type (file_info)
  36. resource(%d) of type (file_info)
  37. object(finfo)#%d (%d) {
  38. }
  39. object(finfo)#%d (%d) {
  40. }
  41. ===DONE===