Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / imap / tests / imap_fetchbody_variation3.phpt
blobdc1778e1e039688d2e851743451774336349f0f6
1 --TEST--
2 Test imap_fetchbody() function : usage variation - diff data types as $section arg
3 --SKIPIF--
4 <?php
5 require_once(dirname(__FILE__).'/skipif.inc');
6 ?>
7 --FILE--
8 <?php
9 /* Prototype  : string imap_fetchbody(resource $stream_id, int $msg_no, string $section 
10  *           [, int $options])
11  * Description: Get a specific body section 
12  * Source code: ext/imap/php_imap.c
13  */
16  * Pass different data types as $section argument to test behaviour of imap_fetchbody()
17  */
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
25 $msg_no = 1;
27 //get an unset variable
28 $unset_var = 10;
29 unset ($unset_var);
31 // get a class
32 class classA
34   public function __toString() {
35     return "Class A object";
36   }
39 // heredoc string
40 $heredoc = <<<EOT
41 hello world
42 EOT;
44 // unexpected values to be passed to $section argument
45 $inputs = array(
47        // int data
48 /*1*/  0,
49        1,
50        12345,
51        -2345,
53        // float data
54 /*5*/  10.5,
55        -10.5,
56        12.3456789000e10,
57        12.3456789000E-10,
58        .5,
60        // null data
61 /*10*/ NULL,
62        null,
64        // boolean data
65 /*12*/ true,
66        false,
67        TRUE,
68        FALSE,
69        
70        // empty data
71 /*16*/ "",
72        '',
73        array(),
75        // string data
76 /*19*/ "string",
77        'string',
78        $heredoc,
79        
80        // object data
81 /*22*/ new classA(),
83        // undefined data
84 /*23*/ @$undefined_var,
86        // unset data
87 /*24*/ @$unset_var,
90 // loop through each element of $inputs to check the behavior of imap_fetchbody()
91 $iterator = 1;
92 foreach($inputs as $input) {
93   echo "\n-- Iteration $iterator --\n";
94   var_dump( imap_fetchbody($stream_id, $msg_no, $input) );
95   $iterator++;
98 ===DONE===
99 --CLEAN--
100 <?php
101 require_once(dirname(__FILE__).'/clean.inc');
103 --EXPECTF--
104 *** Testing imap_fetchbody() : usage variations ***
105 Create a temporary mailbox and add 1 msgs
106 .. mailbox '%s.phpttest' created
108 -- Iteration 1 --
109 string(71) "From: %s
110 To: %s
111 Subject: test1
115 -- Iteration 2 --
116 %unicode|string%(%d) "1: this is a test message, please ignore%a"
118 -- Iteration 3 --
119 %unicode|string%(0) ""
121 -- Iteration 4 --
122 %unicode|string%(0) ""
124 -- Iteration 5 --
125 %unicode|string%(0) ""
127 -- Iteration 6 --
128 %unicode|string%(0) ""
130 -- Iteration 7 --
131 %unicode|string%(0) ""
133 -- Iteration 8 --
134 %unicode|string%(0) ""
136 -- Iteration 9 --
137 %unicode|string%(0) ""
139 -- Iteration 10 --
140 %unicode|string%(%d) "From: %s
141 To: %s
142 Subject: test1
144 1: this is a test message, please ignore%a"
146 -- Iteration 11 --
147 %unicode|string%(%d) "From: %s
148 To: %s
149 Subject: test1
151 1: this is a test message, please ignore%a"
153 -- Iteration 12 --
154 %unicode|string%(%d) "1: this is a test message, please ignore%a"
156 -- Iteration 13 --
157 %unicode|string%(%d) "From: %s
158 To: %s
159 Subject: test1
161 1: this is a test message, please ignore%a"
163 -- Iteration 14 --
164 %unicode|string%(%d) "1: this is a test message, please ignore%a"
166 -- Iteration 15 --
167 %unicode|string%(%d) "From: %s
168 To: %s
169 Subject: test1
171 1: this is a test message, please ignore%a"
173 -- Iteration 16 --
174 %unicode|string%(%d) "From: %s
175 To: %s
176 Subject: test1
178 1: this is a test message, please ignore%a"
180 -- Iteration 17 --
181 %unicode|string%(%d) "From: %s
182 To: %s
183 Subject: test1
185 1: this is a test message, please ignore%a"
187 -- Iteration 18 --
189 Warning: imap_fetchbody() expects parameter 3 to be %unicode_string_optional%, array given in %s on line 87
190 NULL
192 -- Iteration 19 --
193 %unicode|string%(0) ""
195 -- Iteration 20 --
196 %unicode|string%(0) ""
198 -- Iteration 21 --
199 %unicode|string%(0) ""
201 -- Iteration 22 --
202 %unicode|string%(0) ""
204 -- Iteration 23 --
205 %unicode|string%(%d) "From: %s
206 To: %s
207 Subject: test1
209 1: this is a test message, please ignore%a"
211 -- Iteration 24 --
212 %unicode|string%(%d) "From: %s
213 To: %s
214 Subject: test1
216 1: this is a test message, please ignore%a"
217 ===DONE===