Annotation of embedaddon/php/ext/standard/tests/array/each_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test each() function : error conditions - pass incorrect number of args
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : array each(array $arr)
                      6:  * Description: Return the currently pointed key..value pair in the passed array, 
                      7:  * and advance the pointer to the next element 
                      8:  * Source code: Zend/zend_builtin_functions.c
                      9:  */
                     10: 
                     11: /*
                     12:  * Pass an incorrect number of arguments to each() to test behaviour
                     13:  */
                     14: 
                     15: echo "*** Testing each() : error conditions ***\n";
                     16: 
                     17: // Zero arguments
                     18: echo "\n-- Testing each() function with Zero arguments --\n";
                     19: var_dump( each() );
                     20: 
                     21: //Test each with one more than the expected number of arguments
                     22: echo "\n-- Testing each() function with more than expected no. of arguments --\n";
                     23: $arr = array(1, 2);
                     24: $extra_arg = 10;
                     25: var_dump( each($arr, $extra_arg) );
                     26: 
                     27: echo "Done";
                     28: ?>
                     29: 
                     30: --EXPECTF--
                     31: *** Testing each() : error conditions ***
                     32: 
                     33: -- Testing each() function with Zero arguments --
                     34: 
                     35: Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
                     36: NULL
                     37: 
                     38: -- Testing each() function with more than expected no. of arguments --
                     39: 
                     40: Warning: each() expects exactly 1 parameter, 2 given in %s on line %d
                     41: NULL
                     42: Done
                     43: 

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