Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / imap / tests / imap_fetchbody_variation6.phpt
blob52a50a77d66a908c8b72a90ac9d864305e24a5e2
1 --TEST--
2 Test imap_fetchbody() function : usage variations - $msg_no 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 [, int $options])
10  * Description: Get a specific body section 
11  * Source code: ext/imap/php_imap.c
12  */
15  * Pass different integers, strings, msg sequences and msg UIDs as $msg_no argument
16  * 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 required variables
24 $stream_id = setup_test_mailbox('', 3); // set up temp mailbox with  simple msgs
25 $section = 1;
27 $sequences = array (0,     4, // out of range
28                     '1,3', '1:3', // message sequences instead of numbers
29                    );
31 foreach($sequences as $msg_no) {
32         echo "\n-- \$msg_no is $msg_no --\n";
33         var_dump($overview = imap_fetchbody($stream_id, $msg_no, $section));
34         if (!$overview) {
35                 echo imap_last_error() . "\n";
36         }
39 ===DONE===
40 --CLEAN--
41 <?php
42 require_once(dirname(__FILE__).'/clean.inc');
44 --EXPECTF--
45 *** Testing imap_fetchbody() : usage variations ***
46 Create a temporary mailbox and add 3 msgs
47 .. mailbox '{%s}%s' created
49 -- $msg_no is 0 --
51 Warning: imap_fetchbody(): Bad message number in %s on line %d
52 bool(false)
55 -- $msg_no is 4 --
57 Warning: imap_fetchbody(): Bad message number in %s on line %d
58 bool(false)
61 -- $msg_no is 1,3 --
63 Notice: A non well formed numeric value encountered in %s on line %d
64 %unicode|string%(%d) "1: this is a test message, please ignore%a"
66 -- $msg_no is 1:3 --
68 Notice: A non well formed numeric value encountered in %s on line %d
69 %unicode|string%(%d) "1: this is a test message, please ignore%a"
70 ===DONE===