1--TEST--
2Test imap_close() function : basic functionality
3--SKIPIF--
4<?php
5require_once(__DIR__.'/setup/skipif.inc');
6?>
7--FILE--
8<?php
9echo "*** Testing imap_close() : basic functionality ***\n";
10
11// include file for required variables in imap_open()
12require_once(__DIR__.'/setup/imap_include.inc');
13
14// Initialize required variables
15$stream_id = setup_test_mailbox('imapclosebasic', 3, $mailbox); // set up temp mailbox with 3 messages
16$options = CL_EXPUNGE;
17
18// mark messages in inbox for deletion
19for ($i = 1; $i < 4; $i++) {
20    imap_delete($stream_id, $i);
21}
22
23// Calling imap_close() with all possible arguments
24echo "\n-- Call to imap_close() with all possible arguments --\n";
25var_dump( imap_close($stream_id, $options) );
26
27// check that CL_EXPUNGE worked
28$stream_id = imap_open($mailbox, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD);
29echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n";
30
31// Calling imap_close() with mandatory arguments
32echo "\n-- Call to imap_close() with mandatory arguments --\n";
33var_dump( imap_close($stream_id) );
34?>
35--CLEAN--
36<?php
37$mailbox_suffix = 'imapclosebasic';
38require_once(__DIR__.'/setup/clean.inc');
39?>
40--EXPECTF--
41*** Testing imap_close() : basic functionality ***
42Create a temporary mailbox and add 3 msgs
43New mailbox created
44
45-- Call to imap_close() with all possible arguments --
46bool(true)
47There are now 0 msgs in mailbox '%sINBOX.phpttestimapclosebasic'
48
49-- Call to imap_close() with mandatory arguments --
50bool(true)
51