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