Annotation of embedaddon/php/ext/imap/tests/imap_fetchheader_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test imap_fetchheader() function : basic function
! 3: --SKIPIF--
! 4: <?php
! 5: require_once(dirname(__FILE__).'/skipif.inc');
! 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: echo "*** Testing imap_fetchheader() : basic functionality ***\n";
! 15: require_once(dirname(__FILE__).'/imap_include.inc');
! 16:
! 17: // Initialise all required variables
! 18: $stream_id = setup_test_mailbox('', 1, $mailbox, 'multiPart'); // setup temp mailbox with 1 msg
! 19: $msg_no = 1;
! 20: $options = array('FT_UID' => FT_UID, 'FT_INTERNAL' => FT_INTERNAL,
! 21: 'FT_PREFETCHTEXT' => FT_PREFETCHTEXT);
! 22:
! 23: // Calling imap_fetchheader() with all possible arguments
! 24: echo "\n-- All possible arguments --\n";
! 25: foreach ($options as $key => $option) {
! 26: echo "-- Option is $key --\n";
! 27: if ($key == 'FT_UID') {
! 28: $msg_uid = imap_uid($stream_id, $msg_no);
! 29: var_dump(imap_fetchheader($stream_id, $msg_uid, $option));
! 30: } else {
! 31: var_dump(imap_fetchheader($stream_id, $msg_no, $option));
! 32: }
! 33: }
! 34:
! 35: // Calling imap_fetchheader() with mandatory arguments
! 36: echo "\n-- Mandatory arguments --\n";
! 37: var_dump( imap_fetchheader($stream_id, $msg_no) );
! 38: ?>
! 39: ===DONE===
! 40: --CLEAN--
! 41: <?php
! 42: require_once(dirname(__FILE__).'/clean.inc');
! 43: ?>
! 44: --EXPECTF--
! 45: *** Testing imap_fetchheader() : basic functionality ***
! 46: Create a temporary mailbox and add 1 msgs
! 47: .. mailbox '%s.phpttest' created
! 48:
! 49: -- All possible arguments --
! 50: -- Option is FT_UID --
! 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: "
! 58: -- Option is FT_INTERNAL --
! 59: string(%d) "From: foo@anywhere.com
! 60: Subject: Test msg 1
! 61: To: %s
! 62: MIME-Version: 1.0
! 63: Content-Type: %s; %s
! 64:
! 65: "
! 66: -- Option is FT_PREFETCHTEXT --
! 67: string(%d) "From: foo@anywhere.com
! 68: Subject: Test msg 1
! 69: To: %s
! 70: MIME-Version: 1.0
! 71: Content-Type: %s; %s
! 72:
! 73: "
! 74:
! 75: -- Mandatory arguments --
! 76: string(%d) "From: foo@anywhere.com
! 77: Subject: Test msg 1
! 78: To: %s
! 79: MIME-Version: 1.0
! 80: Content-Type: %s; %s
! 81:
! 82: "
! 83: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>