Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / imap / tests / imap_fetch_overview_variation2.phpt
blob086885f6a5cf76514544243280646fb4ec45504e
1 --TEST--
2 Test imap_fetch_overview() function : usage variations - diff data types as $msg_no arg
3 --SKIPIF--
4 <?php
5 require_once(dirname(__FILE__).'/skipif.inc');
6 ?>
7 --FILE--
8 <?php
9 /* Prototype  : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options])
10  * Description: Read an overview of the information in the headers 
11  * of the given message sequence 
12  * Source code: ext/imap/php_imap.c
13  */
16  * Pass different data types as $msg_no argument to imap_fetch_overview() to test behaviour
17  */
19 echo "*** Testing imap_fetch_overview() : usage variations ***\n";
20 require_once(dirname(__FILE__).'/imap_include.inc');
22 // Initialise function arguments not being substituted
23 $stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple'); // set up temp mailbox with 1 msg
25 //get an unset variable
26 $unset_var = 10;
27 unset ($unset_var);
29 // get a class
30 class classA
32   public function __toString() {
33     return "Class A object";
34   }
37 // heredoc string
38 $heredoc = <<<EOT
39 hello world
40 EOT;
42 // get a resource variable
43 $fp = fopen(__FILE__, "r");
45 // unexpected values to be passed to <<<ARGUMENT HERE>>> argument
46 $inputs = array(
48        // int data
49 /*1*/  0,
50        1,
51        12345,
52        -2345,
54        // float data
55 /*5*/  10.5,
56        -10.5,
57        12.3456789000e10,
58        12.3456789000E-10,
59        .5,
61        // null data
62 /*10*/ NULL,
63        null,
65        // boolean data
66 /*12*/ true,
67        false,
68        TRUE,
69        FALSE,
70        
71        // empty data
72 /*16*/ "",
73        '',
74        array(),
76        // string data
77 /*19*/ "string",
78        'string',
79        $heredoc,
80        
81        // object data
82 /*22*/ new classA(),
84        // undefined data
85 /*23*/ @$undefined_var,
87        // unset data
88 /*24*/ @$unset_var,
90        // resource variable
91 /*25*/ $fp
94 // loop through each element of $inputs to check the behavior of imap_fetch_overview()
95 $iterator = 1;
96 foreach($inputs as $input) {
97         echo "\n-- Testing with second argument value: ";
98         var_dump($input);
99         $overview = imap_fetch_overview($stream_id, $input);
100         if (!$overview) {
101                 echo imap_last_error() . "\n";
102         } else {
103                 displayOverviewFields($overview[0]);
104         }
105         $iterator++;
108 fclose($fp);
110 // clear the error stack
111 imap_errors();
113 ===DONE===
114 --CLEAN--
115 <?php
116 require_once(dirname(__FILE__).'/clean.inc');
118 --EXPECTF--
119 *** Testing imap_fetch_overview() : usage variations ***
120 Create a temporary mailbox and add 1 msgs
121 .. mailbox '{%s}%s' created
123 -- Testing with second argument value: int(0)
124 Sequence out of range
126 -- Testing with second argument value: int(1)
127 size is %d
128 uid is %d
129 msgno is 1
130 recent is %d
131 flagged is 0
132 answered is 0
133 deleted is 0
134 seen is 0
135 draft is 0
136 udate is OK
138 -- Testing with second argument value: int(12345)
139 Sequence out of range
141 -- Testing with second argument value: int(-2345)
142 Syntax error in sequence
144 -- Testing with second argument value: float(10.5)
145 Sequence out of range
147 -- Testing with second argument value: float(-10.5)
148 Syntax error in sequence
150 -- Testing with second argument value: float(123456789000)
151 Sequence out of range
153 -- Testing with second argument value: float(1.23456789E-9)
154 Sequence syntax error
156 -- Testing with second argument value: float(0.5)
157 Sequence out of range
159 -- Testing with second argument value: NULL
160 Sequence out of range
162 -- Testing with second argument value: NULL
163 Sequence out of range
165 -- Testing with second argument value: bool(true)
166 size is %d
167 uid is %d
168 msgno is 1
169 recent is %d
170 flagged is 0
171 answered is 0
172 deleted is 0
173 seen is 0
174 draft is 0
175 udate is OK
177 -- Testing with second argument value: bool(false)
178 Sequence out of range
180 -- Testing with second argument value: bool(true)
181 size is %d
182 uid is %d
183 msgno is 1
184 recent is %d
185 flagged is 0
186 answered is 0
187 deleted is 0
188 seen is 0
189 draft is 0
190 udate is OK
192 -- Testing with second argument value: bool(false)
193 Sequence out of range
195 -- Testing with second argument value: %string|unicode%(0) ""
196 Sequence out of range
198 -- Testing with second argument value: %string|unicode%(0) ""
199 Sequence out of range
201 -- Testing with second argument value: array(0) {
204 Warning: imap_fetch_overview() expects parameter 2 to be %binary_string_optional%, array given in %s on line %d
205 Sequence out of range
207 -- Testing with second argument value: %string|unicode%(6) "string"
208 Syntax error in sequence
210 -- Testing with second argument value: %string|unicode%(6) "string"
211 Syntax error in sequence
213 -- Testing with second argument value: %string|unicode%(11) "hello world"
214 Syntax error in sequence
216 -- Testing with second argument value: object(classA)#1 (0) {
218 Syntax error in sequence
220 -- Testing with second argument value: NULL
221 Syntax error in sequence
223 -- Testing with second argument value: NULL
224 Syntax error in sequence
226 -- Testing with second argument value: resource(%d) of type (stream)
228 Warning: imap_fetch_overview() expects parameter 2 to be %binary_string_optional%, resource given in %s on line %d
229 Syntax error in sequence
230 ===DONE===