imap_fetchheader_variation4.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Test imap_fetchheader() function : usage variations - diff resource types 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 : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options])
  10. * Description: Get the full unfiltered header for a message
  11. * Source code: ext/imap/php_imap.c
  12. */
  13. /*
  14. * Pass different types of resources to imap_fetchheader() to test behaviour
  15. */
  16. echo "*** Testing imap_fetchheader() : usage variations ***\n";
  17. echo "\n-- File Resource opened with fopen() --\n";
  18. var_dump($file_pointer = fopen(__FILE__, 'r+'));
  19. var_dump(imap_fetchheader($file_pointer, 1));
  20. fclose($file_pointer);
  21. echo "\n-- Directory Resource opened with opendir() --\n";
  22. var_dump($dir_handle = opendir(dirname(__FILE__)));
  23. var_dump(imap_fetchheader($dir_handle, 1));
  24. closedir($dir_handle);
  25. ?>
  26. ===DONE===
  27. --EXPECTF--
  28. *** Testing imap_fetchheader() : usage variations ***
  29. -- File Resource opened with fopen() --
  30. resource(%d) of type (stream)
  31. Warning: imap_fetchheader(): supplied resource is not a valid imap resource in %s on line %d
  32. bool(false)
  33. -- Directory Resource opened with opendir() --
  34. resource(%d) of type (stream)
  35. Warning: imap_fetchheader(): supplied resource is not a valid imap resource in %s on line %d
  36. bool(false)
  37. ===DONE===