imap_close_error.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Test imap_close() function : error conditions - incorrect number of args
  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. * Pass an incorrect number of arguments to imap_close() to test behaviour
  15. */
  16. echo "*** Testing imap_close() : error conditions ***\n";
  17. require_once(dirname(__FILE__).'/imap_include.inc');
  18. // Zero arguments
  19. echo "\n-- Testing imap_close() function with Zero arguments --\n";
  20. var_dump( imap_close() );
  21. //Test imap_close with one more than the expected number of arguments
  22. echo "\n-- Testing imap_close() function with more than expected no. of arguments --\n";
  23. $stream_id = imap_open($server, $username, $password);
  24. $options = CL_EXPUNGE;
  25. $extra_arg = 10;
  26. var_dump( imap_close($stream_id, $options, $extra_arg) );
  27. ?>
  28. ===DONE===
  29. --EXPECTF--
  30. *** Testing imap_close() : error conditions ***
  31. -- Testing imap_close() function with Zero arguments --
  32. Warning: imap_close() expects at least 1 parameter, 0 given in %s on line %d
  33. NULL
  34. -- Testing imap_close() function with more than expected no. of arguments --
  35. Warning: imap_close() expects at most 2 parameters, 3 given in %s on line %d
  36. NULL
  37. ===DONE===