Annotation of embedaddon/php/ext/imap/tests/imap_fetchbody_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test imap_fetchbody() function : basic functionality
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: */
14:
15: echo "*** Testing imap_fetchbody() : basic functionality ***\n";
16: require_once(dirname(__FILE__).'/imap_include.inc');
17:
18: // Initialise all required variables
19:
20: // set up mailbox with one message
21: $stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple');
22:
23: $msg_no = 1;
24: $section = '2';
25: $options = array ('FT_UID' => FT_UID, 'FT_PEEK' => FT_PEEK, 'FT_INTERNAL' => FT_INTERNAL);
26:
27: // Calling imap_fetchbody() with all possible arguments
28: echo "\n-- All possible arguments --\n";
29: foreach ($options as $key => $option) {
30: echo "-- Option is $key --\n";
31: switch ($key) {
32:
33: case 'FT_UID';
34: $msg_uid = imap_uid($stream_id, $msg_no);
35: var_dump( imap_fetchbody($stream_id, $msg_uid, $section, $option) );
36: break;
37:
38: case 'FT_PEEK';
39: var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) );
40: $overview = imap_fetch_overview($stream_id, 1);
41: echo "Seen Flag: ";
42: var_dump( $overview[0]->seen );
43: break;
44:
45: case 'FT_INTERNAL';
46: var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) );
47: break;
48:
49: }
50: }
51:
52: // Calling imap_fetchbody() with mandatory arguments
53: echo "\n-- Mandatory arguments --\n";
54: var_dump( imap_fetchbody($stream_id, $msg_no, $section) );
55: $overview = imap_fetch_overview($stream_id, 1);
56: echo "Seen Flag: ";
57: var_dump( $overview[0]->seen );
58: ?>
59: ===DONE===
60: --CLEAN--
61: <?php
62: require_once(dirname(__FILE__).'/clean.inc');
63: ?>
64: --EXPECTF--
65: *** Testing imap_fetchbody() : basic functionality ***
66: Create a temporary mailbox and add 1 msgs
67: .. mailbox '{%s}%s' created
68:
69: -- All possible arguments --
70: -- Option is FT_UID --
71: %unicode|string%(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
72: -- Option is FT_PEEK --
73: %unicode|string%(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
74: Seen Flag: int(%d)
75: -- Option is FT_INTERNAL --
76: %unicode|string%(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
77:
78: -- Mandatory arguments --
79: %unicode|string%(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
80: Seen Flag: int(%d)
81: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>