Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / imap / tests / imap_fetchheader_variation2.phpt
blobfe115779f43c97a204ef4e5f83c0cef0a242837c
1 --TEST--
2 Test imap_fetchheader() function : usage variations - diff data types for $msg_no arg
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  */
15  * Pass different data types as $msg_no argument to test behaviour of imap_fetchheader()
16  */
18 echo "*** Testing imap_fetchheader() : usage variations ***\n";
19 require_once(dirname(__FILE__).'/imap_include.inc');
21 // Initialise function arguments not being substituted
22 $stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple'); // set up temp mailbox with 1 msg
24 //get an unset variable
25 $unset_var = 10;
26 unset ($unset_var);
28 // get a class
29 class classA
31   public function __toString() {
32     return "Class A object";
33   }
36 // heredoc string
37 $heredoc = <<<EOT
38 hello world
39 EOT;
41 $index_array = array (1, 2, 3);
42 $assoc_array = array ('one' => 1, 'two' => 2);
44 // get a resource variable
45 $fp = fopen(__FILE__, "r");
47 // unexpected values to be passed to $msg_no argument
48 $inputs = array(
50        // int data
51 /*1*/  0,
52        1,
53        12345,
54        -2345,
56        // float data
57 /*5*/  10.5,
58        -10.5,
59        12.3456789000e10,
60        12.3456789000E-10,
61        .5,
63        // null data
64 /*10*/ NULL,
65        null,
67        // boolean data
68 /*12*/ true,
69        false,
70        TRUE,
71        FALSE,
72        
73        // empty data
74 /*16*/ "",
75        '',
77        // string data
78 /*18*/ "string",
79        'string',
80        $heredoc,
81        
82        // array data
83 /*21*/ array(),
84        $index_array,
85        $assoc_array,
86        array('foo', $index_array, $assoc_array),
87        
88        
89        // object data
90 /*25*/ new classA(),
92        // undefined data
93 /*26*/ @$undefined_var,
95        // unset data
96 /*27*/ @$unset_var,
98        // resource variable
99 /*28*/ $fp
102 // loop through each element of $inputs to check the behavior of imap_fetchheader()
103 $iterator = 1;
104 foreach($inputs as $input) {
105   echo "\n-- Iteration $iterator --\n";
106   var_dump( imap_fetchheader($stream_id, $input) );
107   $iterator++;
110 fclose($fp);
112 ===DONE===
113 --CLEAN--
114 <?php
115 require_once(dirname(__FILE__).'/clean.inc');
117 ===DONE===
118 --EXPECTF--
119 *** Testing imap_fetchheader() : usage variations ***
120 Create a temporary mailbox and add 1 msgs
121 .. mailbox '{%s}%s' created
123 -- Iteration 1 --
125 Warning: imap_fetchheader(): Bad message number in %s on line %d
126 bool(false)
128 -- Iteration 2 --
129 %unicode|string%(%d) "From: foo@anywhere.com
130 Subject: Test msg 1
131 To: %s
132 MIME-Version: 1.0
133 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
137 -- Iteration 3 --
139 Warning: imap_fetchheader(): Bad message number in %s on line %d
140 bool(false)
142 -- Iteration 4 --
144 Warning: imap_fetchheader(): Bad message number in %s on line %d
145 bool(false)
147 -- Iteration 5 --
149 Warning: imap_fetchheader(): Bad message number in %s on line %d
150 bool(false)
152 -- Iteration 6 --
154 Warning: imap_fetchheader(): Bad message number in %s on line %d
155 bool(false)
157 -- Iteration 7 --
159 Warning: imap_fetchheader(): Bad message number in %s on line %d
160 bool(false)
162 -- Iteration 8 --
164 Warning: imap_fetchheader(): Bad message number in %s on line %d
165 bool(false)
167 -- Iteration 9 --
169 Warning: imap_fetchheader(): Bad message number in %s on line %d
170 bool(false)
172 -- Iteration 10 --
174 Warning: imap_fetchheader(): Bad message number in %s on line %d
175 bool(false)
177 -- Iteration 11 --
179 Warning: imap_fetchheader(): Bad message number in %s on line %d
180 bool(false)
182 -- Iteration 12 --
183 %unicode|string%(%d) "From: foo@anywhere.com
184 Subject: Test msg 1
185 To: %s
186 MIME-Version: 1.0
187 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
191 -- Iteration 13 --
193 Warning: imap_fetchheader(): Bad message number in %s on line %d
194 bool(false)
196 -- Iteration 14 --
197 %unicode|string%(%d) "From: foo@anywhere.com
198 Subject: Test msg 1
199 To: %s
200 MIME-Version: 1.0
201 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
205 -- Iteration 15 --
207 Warning: imap_fetchheader(): Bad message number in %s on line %d
208 bool(false)
210 -- Iteration 16 --
212 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
213 NULL
215 -- Iteration 17 --
217 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
218 NULL
220 -- Iteration 18 --
222 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
223 NULL
225 -- Iteration 19 --
227 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
228 NULL
230 -- Iteration 20 --
232 Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
233 NULL
235 -- Iteration 21 --
237 Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
238 NULL
240 -- Iteration 22 --
242 Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
243 NULL
245 -- Iteration 23 --
247 Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
248 NULL
250 -- Iteration 24 --
252 Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
253 NULL
255 -- Iteration 25 --
257 Warning: imap_fetchheader() expects parameter 2 to be long, object given in %s on line %d
258 NULL
260 -- Iteration 26 --
262 Warning: imap_fetchheader(): Bad message number in %s on line %d
263 bool(false)
265 -- Iteration 27 --
267 Warning: imap_fetchheader(): Bad message number in %s on line %d
268 bool(false)
270 -- Iteration 28 --
272 Warning: imap_fetchheader() expects parameter 2 to be long, resource given in %s on line %d
273 NULL
274 ===DONE===