Annotation of embedaddon/php/ext/imap/tests/imap_fetchbody_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test imap_fetchbody() 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 :string imap_fetchbody(resource $stream_id, int $msg_no, string $section
! 10: * [, int $options])
! 11: * Description: Get a specific body section
! 12: * Source code: ext/imap/php_imap.c
! 13: */
! 14:
! 15: /*
! 16: * Pass an incorrect number of arguments to imap_fetchbody() to test behaviour
! 17: */
! 18:
! 19: echo "*** Testing imap_fetchbody() : error conditions ***\n";
! 20: require_once(dirname(__FILE__).'/imap_include.inc');
! 21:
! 22: //Test imap_fetchbody with one more than the expected number of arguments
! 23: echo "\n-- Testing imap_fetchbody() function with more than expected no. of arguments --\n";
! 24:
! 25: $stream_id = setup_test_mailbox('', 1); // set up temp mailbox with 1 simple msg
! 26: $msg_no = 1;
! 27: $section = '1';
! 28: $options = FT_PEEK;
! 29: $extra_arg = 10;
! 30:
! 31: var_dump( imap_fetchbody($stream_id, $msg_no, $section, $options, $extra_arg) );
! 32:
! 33: // Testing imap_fetchbody with one less than the expected number of arguments
! 34: echo "\n-- Testing imap_fetchbody() function with less than expected no. of arguments --\n";
! 35:
! 36: var_dump( imap_fetchbody($stream_id, $msg_no) );
! 37: ?>
! 38: ===DONE===
! 39: --CLEAN--
! 40: <?php
! 41: require_once(dirname(__FILE__).'/clean.inc');
! 42: ?>
! 43: --EXPECTF--
! 44: *** Testing imap_fetchbody() : error conditions ***
! 45:
! 46: -- Testing imap_fetchbody() function with more than expected no. of arguments --
! 47: Create a temporary mailbox and add 1 msgs
! 48: .. mailbox '{%s}%s' created
! 49:
! 50: Warning: imap_fetchbody() expects at most 4 parameters, 5 given in %s on line %d
! 51: NULL
! 52:
! 53: -- Testing imap_fetchbody() function with less than expected no. of arguments --
! 54:
! 55: Warning: imap_fetchbody() expects at least 3 parameters, 2 given in %s on line %d
! 56: NULL
! 57: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>