finfo_close_error.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Test finfo_close() function : error conditions
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. /* Prototype : resource finfo_close(resource finfo)
  8. * Description: Close fileinfo resource.
  9. * Source code: ext/fileinfo/fileinfo.c
  10. * Alias to functions:
  11. */
  12. echo "*** Testing finfo_close() : error conditions ***\n";
  13. $magicFile = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'magic';
  14. $finfo = finfo_open( FILEINFO_MIME, $magicFile );
  15. $fp = fopen( __FILE__, 'r' );
  16. echo "\n-- Testing finfo_close() function with Zero arguments --\n";
  17. var_dump( finfo_close() );
  18. echo "\n-- Testing finfo_close() function with more than expected no. of arguments --\n";
  19. var_dump( finfo_close( $finfo, '10') );
  20. echo "\n-- Testing finfo_close() function with wrong resource type --\n";
  21. var_dump( finfo_close( $fp ) );
  22. ?>
  23. ===DONE===
  24. --EXPECTF--
  25. *** Testing finfo_close() : error conditions ***
  26. -- Testing finfo_close() function with Zero arguments --
  27. Warning: finfo_close() expects exactly 1 parameter, 0 given in %s on line %d
  28. bool(false)
  29. -- Testing finfo_close() function with more than expected no. of arguments --
  30. Warning: finfo_close() expects exactly 1 parameter, 2 given in %s on line %d
  31. bool(false)
  32. -- Testing finfo_close() function with wrong resource type --
  33. Warning: finfo_close(): supplied resource is not a valid file_info resource in %s on line %d
  34. bool(false)
  35. ===DONE===