1--TEST--
2imap_renamemailbox() function : basic functionality
3--CREDITS--
4Olivier Doucet
5--SKIPIF--
6<?php
7require_once(dirname(__FILE__).'/skipif.inc');
8?>
9--FILE--
10<?php
11echo "Checking with no parameters\n";
12imap_renamemailbox();
13
14echo  "Checking with incorrect parameter type\n";
15imap_renamemailbox('');
16imap_renamemailbox(false);
17
18
19require_once(dirname(__FILE__).'/imap_include.inc');
20
21$stream_id = setup_test_mailbox('', 1);
22
23if (!is_resource($stream_id)) {
24	exit("TEST FAILED: Unable to create test mailbox\n");
25}
26
27$newbox = $default_mailbox . "." . $mailbox_prefix;
28
29imap_renamemailbox($stream_id, $newbox.'not');
30imap_renamemailbox($stream_id, $newbox);
31
32//commented because of bug #49901
33//$ancError = error_reporting(0);
34//$z = imap_renamemailbox($stream_id, $newbox.'not2', $newbox.'2');
35//var_dump($z);
36//error_reporting($ancError);
37echo "Checking OK\n";
38
39
40var_dump(imap_createmailbox($stream_id, $newbox.'.test'));
41var_dump(imap_renamemailbox($stream_id, $newbox.'.test', $newbox.'.testd'));
42
43imap_close($stream_id);
44?>
45--CLEAN--
46<?php
47require_once('clean.inc');
48?>
49--EXPECTF--
50Checking with no parameters
51
52Warning: imap_renamemailbox() expects exactly 3 parameters, 0 given in %s on line %d
53Checking with incorrect parameter type
54
55Warning: imap_renamemailbox() expects exactly 3 parameters, 1 given in %s on line %d
56
57Warning: imap_renamemailbox() expects exactly 3 parameters, 1 given in %s on line %d
58Create a temporary mailbox and add 1 msgs
59.. mailbox '{%s}%s' created
60
61Warning: imap_renamemailbox() expects exactly 3 parameters, 2 given in %s on line %d
62
63Warning: imap_renamemailbox() expects exactly 3 parameters, 2 given in %s on line %d
64Checking OK
65bool(true)
66bool(true)
67