Annotation of embedaddon/php/ext/imap/tests/imap_fetchbody_variation6.phpt, revision 1.1.1.1
1.1 misho 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: */
13:
14: /*
15: * Pass different integers, strings, msg sequences and msg UIDs as $msg_no argument
16: * to test behaviour of imap_fetchbody()
17: */
18:
19: echo "*** Testing imap_fetchbody() : usage variations ***\n";
20:
21: require_once(dirname(__FILE__).'/imap_include.inc');
22:
23: //Initialise required variables
24: $stream_id = setup_test_mailbox('', 3); // set up temp mailbox with simple msgs
25: $section = 1;
26:
27: $sequences = array (0, 4, // out of range
28: '1,3', '1:3', // message sequences instead of numbers
29: );
30:
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: }
37: }
38: ?>
39: ===DONE===
40: --CLEAN--
41: <?php
42: require_once(dirname(__FILE__).'/clean.inc');
43: ?>
44: --EXPECTF--
45: *** Testing imap_fetchbody() : usage variations ***
46: Create a temporary mailbox and add 3 msgs
47: .. mailbox '{%s}%s' created
48:
49: -- $msg_no is 0 --
50:
51: Warning: imap_fetchbody(): Bad message number in %s on line %d
52: bool(false)
53:
54:
55: -- $msg_no is 4 --
56:
57: Warning: imap_fetchbody(): Bad message number in %s on line %d
58: bool(false)
59:
60:
61: -- $msg_no is 1,3 --
62:
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"
65:
66: -- $msg_no is 1:3 --
67:
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===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>