imap_fetchheader_basic.phpt 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --TEST--
  2. Test imap_fetchheader() function : basic function
  3. --EXTENSIONS--
  4. imap
  5. --SKIPIF--
  6. <?php
  7. require_once(__DIR__.'/setup/skipif.inc');
  8. ?>
  9. --FILE--
  10. <?php
  11. echo "*** Testing imap_fetchheader() : basic functionality ***\n";
  12. require_once(__DIR__.'/setup/imap_include.inc');
  13. // Initialise all required variables
  14. $stream_id = setup_test_mailbox('imapfetchheaderbasic', 1, $mailbox, false); // setup temp mailbox with 1 msg
  15. $msg_no = 1;
  16. $options = array('FT_UID' => FT_UID, 'FT_INTERNAL' => FT_INTERNAL,
  17. 'FT_PREFETCHTEXT' => FT_PREFETCHTEXT);
  18. // Calling imap_fetchheader() with all possible arguments
  19. echo "\n-- All possible arguments --\n";
  20. foreach ($options as $key => $option) {
  21. echo "-- Option is $key --\n";
  22. if ($key == 'FT_UID') {
  23. $msg_uid = imap_uid($stream_id, $msg_no);
  24. var_dump(imap_fetchheader($stream_id, $msg_uid, $option));
  25. } else {
  26. var_dump(imap_fetchheader($stream_id, $msg_no, $option));
  27. }
  28. }
  29. // Calling imap_fetchheader() with mandatory arguments
  30. echo "\n-- Mandatory arguments --\n";
  31. var_dump( imap_fetchheader($stream_id, $msg_no) );
  32. ?>
  33. --CLEAN--
  34. <?php
  35. $mailbox_suffix = 'imapfetchheaderbasic';
  36. require_once(__DIR__.'/setup/clean.inc');
  37. ?>
  38. --EXPECTF--
  39. *** Testing imap_fetchheader() : basic functionality ***
  40. Create a temporary mailbox and add 1 msgs
  41. New mailbox created
  42. -- All possible arguments --
  43. -- Option is FT_UID --
  44. string(%d) "From: foo@anywhere.com
  45. Subject: Test msg 1
  46. To: %s
  47. MIME-Version: 1.0
  48. Content-Type: %s; %s
  49. "
  50. -- Option is FT_INTERNAL --
  51. string(%d) "From: foo@anywhere.com
  52. Subject: Test msg 1
  53. To: %s
  54. MIME-Version: 1.0
  55. Content-Type: %s; %s
  56. "
  57. -- Option is FT_PREFETCHTEXT --
  58. string(%d) "From: foo@anywhere.com
  59. Subject: Test msg 1
  60. To: %s
  61. MIME-Version: 1.0
  62. Content-Type: %s; %s
  63. "
  64. -- Mandatory arguments --
  65. string(%d) "From: foo@anywhere.com
  66. Subject: Test msg 1
  67. To: %s
  68. MIME-Version: 1.0
  69. Content-Type: %s; %s
  70. "