Annotation of embedaddon/php/ext/imap/tests/imap_fetchheader_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test imap_fetchheader() 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_fetchheader(resource $stream_id, int $msg_no [, int $options])
                     10:  * Description: Get the full unfiltered header for a message 
                     11:  * Source code: ext/imap/php_imap.c
                     12:  */
                     13: 
                     14: /*
                     15:  * Pass an incorrect number of arguments to imap_fetchheader() to test behaviour
                     16:  */
                     17: 
                     18: echo "*** Testing imap_fetchheader() : error conditions ***\n";
                     19: require_once(dirname(__FILE__).'/imap_include.inc');
                     20: 
                     21: //Test imap_fetchheader with one more than the expected number of arguments
                     22: echo "\n-- Testing imap_fetchheader() function with more than expected no. of arguments --\n";
                     23: 
                     24: $stream_id = imap_open($server, $username, $password);
                     25: $msg_no = 10;
                     26: $options = 10;
                     27: $extra_arg = 10;
                     28: var_dump( imap_fetchheader($stream_id, $msg_no, $options, $extra_arg) );
                     29: 
                     30: // Testing imap_fetchheader with one less than the expected number of arguments
                     31: echo "\n-- Testing imap_fetchheader() function with less than expected no. of arguments --\n";
                     32: var_dump( imap_fetchheader($stream_id) );
                     33: 
                     34: imap_close($stream_id);
                     35: ?>
                     36: ===DONE===
                     37: --EXPECTF--
                     38: *** Testing imap_fetchheader() : error conditions ***
                     39: 
                     40: -- Testing imap_fetchheader() function with more than expected no. of arguments --
                     41: 
                     42: Warning: imap_fetchheader() expects at most 3 parameters, 4 given in %s on line %d
                     43: NULL
                     44: 
                     45: -- Testing imap_fetchheader() function with less than expected no. of arguments --
                     46: 
                     47: Warning: imap_fetchheader() expects at least 2 parameters, 1 given in %s on line %d
                     48: NULL
                     49: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>