2 Test imap_fetchbody() function : basic functionality
5 require_once(dirname(__FILE__).'/skipif.inc');
9 /* Prototype : string imap_fetchbody(resource $stream_id, int $msg_no, string $section
11 * Description: Get a specific body section
12 * Source code: ext/imap/php_imap.c
15 echo "*** Testing imap_fetchbody() : basic functionality ***\n";
16 require_once(dirname(__FILE__).'/imap_include.inc');
18 // Initialise all required variables
20 // set up mailbox with one message
21 $stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple');
25 $options = array ('FT_UID' => FT_UID, 'FT_PEEK' => FT_PEEK, 'FT_INTERNAL' => FT_INTERNAL);
27 // Calling imap_fetchbody() with all possible arguments
28 echo "\n-- All possible arguments --\n";
29 foreach ($options as $key => $option) {
30 echo "-- Option is $key --\n";
34 $msg_uid = imap_uid($stream_id, $msg_no);
35 var_dump( imap_fetchbody($stream_id, $msg_uid, $section, $option) );
39 var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) );
40 $overview = imap_fetch_overview($stream_id, 1);
42 var_dump( $overview[0]->seen );
46 var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) );
52 // Calling imap_fetchbody() with mandatory arguments
53 echo "\n-- Mandatory arguments --\n";
54 var_dump( imap_fetchbody($stream_id, $msg_no, $section) );
55 $overview = imap_fetch_overview($stream_id, 1);
57 var_dump( $overview[0]->seen );
62 require_once(dirname(__FILE__).'/clean.inc');
65 *** Testing imap_fetchbody() : basic functionality ***
66 Create a temporary mailbox and add 1 msgs
67 .. mailbox '{%s}%s' created
69 -- All possible arguments --
70 -- Option is FT_UID --
71 %unicode|string%(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
72 -- Option is FT_PEEK --
73 %unicode|string%(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
75 -- Option is FT_INTERNAL --
76 %unicode|string%(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
78 -- Mandatory arguments --
79 %unicode|string%(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"