xref: /PHP-5.6/ext/imap/tests/imap_body_basic.phpt (revision 24090104)
1--TEST--
2Test imap_body() function : basic functionality
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__).'/skipif.inc');
6?>
7--FILE--
8<?php
9/* Prototype  : string imap_body  ( resource $imap_stream  , int $msg_number  [, int $options  ] )
10 * Description: Read the message body.
11 * Source code: ext/imap/php_imap.c
12 */
13
14echo "*** Testing imap_body() : basic functionality ***\n";
15
16require_once(dirname(__FILE__).'/imap_include.inc');
17
18echo "Create a new mailbox for test\n";
19$imap_stream = setup_test_mailbox("", 1);
20if (!is_resource($imap_stream)) {
21	exit("TEST FAILED: Unable to create test mailbox\n");
22}
23
24$check = imap_check($imap_stream);
25echo "Msg Count in new mailbox: ". $check->Nmsgs . "\n";
26
27// show body for msg 1
28var_dump(imap_body($imap_stream, 1));
29
30//Access via FT_UID
31var_dump(imap_body($imap_stream, 1, FT_UID));
32
33imap_close($imap_stream);
34?>
35===Done===
36--CLEAN--
37<?php
38require_once('clean.inc');
39?>
40--EXPECTF--
41*** Testing imap_body() : basic functionality ***
42Create a new mailbox for test
43Create a temporary mailbox and add 1 msgs
44.. mailbox '%s' created
45Msg Count in new mailbox: 1
46%unicode|string%(%d) "1: this is a test message, please ignore%a"
47%unicode|string%(%d) "1: this is a test message, please ignore%a"
48===Done===
49