Annotation of embedaddon/php/ext/standard/tests/array/array_walk_recursive_error1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_walk_recursive() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
6: * Description: Apply a user function to every member of an array
7: * Source code: ext/standard/array.c
8: */
9:
10: $input = array(1, 2);
11:
12: /* Prototype : callback(mixed value, mixed key, mixed user_data)
13: * Parameters : value - value in key/value pair
14: * key - key in key/value pair
15: * user_data - extra parameter
16: */
17: function callback ($value, $key, $user_data) {
18: echo "\ncallback() invoked \n";
19: }
20:
21: echo "*** Testing array_walk_recursive() : error conditions ***\n";
22:
23: echo "-- Testing array_walk_recursive() function with zero arguments --\n";
24: var_dump( array_walk_recursive() );
25:
26: echo "-- Testing array_walk_recursive() function with one argument --\n";
27: var_dump( array_walk_recursive($input) );
28:
29: $input = array( array(1, 2), array(3), array(4, 5));
30: echo "-- Testing array_walk_recursive() function with non existent callback function --\n";
31: var_dump( array_walk_recursive($input, "non_existent") );
32:
33: echo "Done";
34: ?>
35: --EXPECTF--
36: *** Testing array_walk_recursive() : error conditions ***
37: -- Testing array_walk_recursive() function with zero arguments --
38:
39: Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d
40: NULL
41: -- Testing array_walk_recursive() function with one argument --
42:
43: Warning: array_walk_recursive() expects at least 2 parameters, 1 given in %s on line %d
44: NULL
45: -- Testing array_walk_recursive() function with non existent callback function --
46:
47: Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d
48: NULL
49: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>