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

1.1       misho       1: --TEST--
                      2: Test array_reduce() function : error conditions 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : mixed array_reduce(array input, mixed callback [, int initial])
                      6:  * Description: Iteratively reduce the array to a single value via the callback. 
                      7:  * Source code: ext/standard/array.c
                      8:  * Alias to functions: 
                      9:  */
                     10: 
                     11: echo "*** Testing array_reduce() : error conditions ***\n";
                     12: 
                     13: 
                     14: //Test array_reduce with one more than the expected number of arguments
                     15: echo "\n-- Testing array_reduce() function with more than expected no. of arguments --\n";
                     16: $input = array(1, 2);
                     17: $callback = 1;
                     18: $initial = 10;
                     19: $extra_arg = 10;
                     20: var_dump( array_reduce($input, $callback, $initial, $extra_arg) );
                     21: 
                     22: // Testing array_reduce with one less than the expected number of arguments
                     23: echo "\n-- Testing array_reduce() function with less than expected no. of arguments --\n";
                     24: $input = array(1, 2);
                     25: var_dump( array_reduce($input) );
                     26: 
                     27: ?>
                     28: ===DONE===
                     29: --EXPECTF--
                     30: *** Testing array_reduce() : error conditions ***
                     31: 
                     32: -- Testing array_reduce() function with more than expected no. of arguments --
                     33: 
                     34: Warning: array_reduce() expects at most 3 parameters, 4 given in %sarray_reduce_error.php on line %d
                     35: NULL
                     36: 
                     37: -- Testing array_reduce() function with less than expected no. of arguments --
                     38: 
                     39: Warning: array_reduce() expects at least 2 parameters, 1 given in %sarray_reduce_error.php on line %d
                     40: NULL
                     41: ===DONE===

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