Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / imap / tests / imap_fetchheader_variation5.phpt
blobed2aa84dcc19005ece71d88ac2b48adeba8353dd
1 --TEST--
2 Test imap_fetchheader() function : usage variations - $msg_no argument
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 integers and strings as $msg_no argument 
16  * to test behaviour of imap_fetchheader()
17  */
19 echo "*** Testing imap_fetchheader() : usage variations ***\n";
21 require_once(dirname(__FILE__).'/imap_include.inc');
23 $stream_id = setup_test_mailbox('', 3, $mailbox, 'notSimple'); // set up temp mailbox with 3 msgs
25 $sequences = array (0,     4, // out of range
26                     '1,3', '1:3', // message sequences instead of numbers
27                     ); 
29 foreach($sequences as $msg_no) {
30         echo "\n-- \$msg_no is $msg_no --\n";
31         var_dump($overview = imap_fetchheader($stream_id, $msg_no));
32         if (!$overview) {
33                 echo imap_last_error() . "\n";
34         }
37 // clear error stack
38 imap_errors();
40 ===DONE===
41 --CLEAN--
42 <?php
43 require_once(dirname(__FILE__).'/clean.inc');
45 --EXPECTF--
46 *** Testing imap_fetchheader() : usage variations ***
47 Create a temporary mailbox and add 3 msgs
48 .. mailbox '{%s}%s' created
50 -- $msg_no is 0 --
52 Warning: imap_fetchheader(): Bad message number in %s on line %d
53 bool(false)
56 -- $msg_no is 4 --
58 Warning: imap_fetchheader(): Bad message number in %s on line %d
59 bool(false)
62 -- $msg_no is 1,3 --
64 Notice: A non well formed numeric value encountered in %s on line %d
65 %unicode|string%(%d) "From: foo@anywhere.com
66 Subject: Test msg 1
67 To: %s
68 MIME-Version: 1.0
69 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
73 -- $msg_no is 1:3 --
75 Notice: A non well formed numeric value encountered in %s on line %d
76 %unicode|string%(%d) "From: foo@anywhere.com
77 Subject: Test msg 1
78 To: %s
79 MIME-Version: 1.0
80 Content-Type: MULTIPART/mixed; BOUNDARY="%s"
83 ===DONE===