imap_close_basic.phpt 1.5 KB

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