2 Test imap_fetchbody() function : usage variation - diff data types as $section arg
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
16 * Pass different data types as $section argument to test behaviour of imap_fetchbody()
19 echo "*** Testing imap_fetchbody() : usage variations ***\n";
21 require_once(dirname(__FILE__).'/imap_include.inc');
23 // Initialise function arguments not being substituted
24 $stream_id = setup_test_mailbox('', 1); // set up temp mailbox with 1 simple msg
27 //get an unset variable
34 public function __toString() {
35 return "Class A object";
44 // unexpected values to be passed to $section argument
84 /*23*/ @$undefined_var,
90 // loop through each element of $inputs to check the behavior of imap_fetchbody()
92 foreach($inputs as $input) {
93 echo "\n-- Iteration $iterator --\n";
94 var_dump( imap_fetchbody($stream_id, $msg_no, $input) );
101 require_once(dirname(__FILE__).'/clean.inc');
104 *** Testing imap_fetchbody() : usage variations ***
105 Create a temporary mailbox and add 1 msgs
106 .. mailbox '%s.phpttest' created
116 %unicode|string%(%d) "1: this is a test message, please ignore%a"
119 %unicode|string%(0) ""
122 %unicode|string%(0) ""
125 %unicode|string%(0) ""
128 %unicode|string%(0) ""
131 %unicode|string%(0) ""
134 %unicode|string%(0) ""
137 %unicode|string%(0) ""
140 %unicode|string%(%d) "From: %s
144 1: this is a test message, please ignore%a"
147 %unicode|string%(%d) "From: %s
151 1: this is a test message, please ignore%a"
154 %unicode|string%(%d) "1: this is a test message, please ignore%a"
157 %unicode|string%(%d) "From: %s
161 1: this is a test message, please ignore%a"
164 %unicode|string%(%d) "1: this is a test message, please ignore%a"
167 %unicode|string%(%d) "From: %s
171 1: this is a test message, please ignore%a"
174 %unicode|string%(%d) "From: %s
178 1: this is a test message, please ignore%a"
181 %unicode|string%(%d) "From: %s
185 1: this is a test message, please ignore%a"
189 Warning: imap_fetchbody() expects parameter 3 to be %unicode_string_optional%, array given in %s on line 87
193 %unicode|string%(0) ""
196 %unicode|string%(0) ""
199 %unicode|string%(0) ""
202 %unicode|string%(0) ""
205 %unicode|string%(%d) "From: %s
209 1: this is a test message, please ignore%a"
212 %unicode|string%(%d) "From: %s
216 1: this is a test message, please ignore%a"