1--TEST--
2Test imap_fetchbody() function : error conditions - incorrect number of args
3--SKIPIF--
4<?php
5require_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/*
16 * Pass an incorrect number of arguments to imap_fetchbody() to test behaviour
17 */
18
19echo "*** Testing imap_fetchbody() : error conditions ***\n";
20require_once(dirname(__FILE__).'/imap_include.inc');
21
22//Test imap_fetchbody with one more than the expected number of arguments
23echo "\n-- Testing imap_fetchbody() function with more than expected no. of arguments --\n";
24
25$stream_id = setup_test_mailbox('', 1); // set up temp mailbox with 1 simple msg
26$msg_no = 1;
27$section = '1';
28$options = FT_PEEK;
29$extra_arg = 10;
30
31var_dump( imap_fetchbody($stream_id, $msg_no, $section, $options, $extra_arg) );
32
33// Testing imap_fetchbody with one less than the expected number of arguments
34echo "\n-- Testing imap_fetchbody() function with less than expected no. of arguments --\n";
35
36var_dump( imap_fetchbody($stream_id, $msg_no) );
37?>
38===DONE===
39--CLEAN--
40<?php
41require_once(dirname(__FILE__).'/clean.inc');
42?>
43--EXPECTF--
44*** Testing imap_fetchbody() : error conditions ***
45
46-- Testing imap_fetchbody() function with more than expected no. of arguments --
47Create a temporary mailbox and add 1 msgs
48.. mailbox '{%s}%s' created
49
50Warning: imap_fetchbody() expects at most 4 parameters, 5 given in %s on line %d
51NULL
52
53-- Testing imap_fetchbody() function with less than expected no. of arguments --
54
55Warning: imap_fetchbody() expects at least 3 parameters, 2 given in %s on line %d
56NULL
57===DONE===
58