Annotation of embedaddon/php/ext/imap/tests/imap_close_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test imap_close() function : basic functionality
! 3: --SKIPIF--
! 4: <?php
! 5: require_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:
! 14: echo "*** Testing imap_close() : basic functionality ***\n";
! 15:
! 16: // include file for required variables in imap_open()
! 17: require_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
! 24: for ($i = 1; $i < 4; $i++) {
! 25: imap_delete($stream_id, $i);
! 26: }
! 27:
! 28: // Calling imap_close() with all possible arguments
! 29: echo "\n-- Call to imap_close() with all possible arguments --\n";
! 30: var_dump( imap_close($stream_id, $options) );
! 31:
! 32: // check that CL_EXPUNGE worked
! 33: $stream_id = imap_open($mailbox, $username, $password);
! 34: echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n";
! 35:
! 36: // Calling imap_close() with mandatory arguments
! 37: echo "\n-- Call to imap_close() with mandatory arguments --\n";
! 38: var_dump( imap_close($stream_id) );
! 39: ?>
! 40: ===DONE===
! 41: --CLEAN--
! 42: <?php
! 43: require_once(dirname(__FILE__).'/clean.inc');
! 44: ?>
! 45: --EXPECTF--
! 46: *** Testing imap_close() : basic functionality ***
! 47: Create a temporary mailbox and add 3 msgs
! 48: .. mailbox '%sINBOX.phpttest' created
! 49:
! 50: -- Call to imap_close() with all possible arguments --
! 51: bool(true)
! 52: There are now 0 msgs in mailbox '%sINBOX.phpttest'
! 53:
! 54: -- Call to imap_close() with mandatory arguments --
! 55: bool(true)
! 56: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>