1--TEST--
2Test imap_close() function : basic functionality
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__).'/skipif.inc');
6?>
7--FILE--
8<?php
9/* Prototype  : bool imap_close(resource $stream_id [, int $options])
10 * Description: Close an IMAP stream
11 * Source code: ext/imap/php_imap.c
12 */
13
14echo "*** Testing imap_close() : basic functionality ***\n";
15
16// include file for required variables in imap_open()
17require_once(dirname(__FILE__).'/imap_include.inc');
18
19// Initialize required variables
20$stream_id = setup_test_mailbox('', 3, $mailbox); // set up temp mailbox with 3 messages
21$options = CL_EXPUNGE;
22
23// mark messages in inbox for deletion
24for ($i = 1; $i < 4; $i++) {
25	imap_delete($stream_id, $i);
26}
27
28// Calling imap_close() with all possible arguments
29echo "\n-- Call to imap_close() with all possible arguments --\n";
30var_dump( imap_close($stream_id, $options) );
31
32// check that CL_EXPUNGE worked
33$stream_id = imap_open($mailbox, $username, $password);
34echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n";
35
36// Calling imap_close() with mandatory arguments
37echo "\n-- Call to imap_close() with mandatory arguments --\n";
38var_dump( imap_close($stream_id) );
39?>
40===DONE===
41--CLEAN--
42<?php
43require_once(dirname(__FILE__).'/clean.inc');
44?>
45--EXPECTF--
46*** Testing imap_close() : basic functionality ***
47Create a temporary mailbox and add 3 msgs
48.. mailbox '%sINBOX.phpttest' created
49
50-- Call to imap_close() with all possible arguments --
51bool(true)
52There are now 0 msgs in mailbox '%sINBOX.phpttest'
53
54-- Call to imap_close() with mandatory arguments --
55bool(true)
56===DONE===
57