imap_fetch_overview_variation4.phpt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test imap_fetch_overview() function : usage variations - different resources as $stream_id
  3. --SKIPIF--
  4. <?php
  5. extension_loaded('imap') or die('skip imap extension not available in this build');
  6. ?>
  7. --FILE--
  8. <?php
  9. /* Prototype : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options])
  10. * Description: Read an overview of the information in the headers
  11. * of the given message sequence
  12. * Source code: ext/imap/php_imap.c
  13. */
  14. /*
  15. * Pass different resource types to imap_fetch_overview() to test behaviour
  16. */
  17. echo "*** Testing imap_fetch_overview() : usage variations ***\n";
  18. echo "\n-- File Resource opened with fopen() --\n";
  19. var_dump($file_pointer = fopen(__FILE__, 'r+'));
  20. var_dump(imap_fetch_overview($file_pointer, 1));
  21. fclose($file_pointer);
  22. echo "\n-- Directory Resource opened with opendir() --\n";
  23. var_dump($dir_handle = opendir(dirname(__FILE__)));
  24. var_dump(imap_fetch_overview($dir_handle, 1));
  25. closedir($dir_handle);
  26. ?>
  27. ===DONE===
  28. --EXPECTF--
  29. *** Testing imap_fetch_overview() : usage variations ***
  30. -- File Resource opened with fopen() --
  31. resource(%d) of type (stream)
  32. Warning: imap_fetch_overview(): supplied resource is not a valid imap resource in %s on line %d
  33. bool(false)
  34. -- Directory Resource opened with opendir() --
  35. resource(%d) of type (stream)
  36. Warning: imap_fetch_overview(): supplied resource is not a valid imap resource in %s on line %d
  37. bool(false)
  38. ===DONE===