Annotation of embedaddon/php/ext/standard/tests/array/array_count_values_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_count_values() function : Invalid parameters
3: --FILE--
4: <?php
5: /* Prototype : proto array array_count_values(array input)
6: * Description: Return the value as key and the frequency of that value in input as value
7: * Source code: ext/standard/array.c
8: * Alias to functions:
9: */
10:
11: /*
12: * Test for handling of incorrect parameters.
13: */
14:
15: echo "*** Testing array_count_values() : error conditions ***\n";
16:
17: // Zero arguments
18: echo "\n-- Testing array_count_values() function with Zero arguments --\n";
19: var_dump( array_count_values() );
20:
21: //Test array_count_values with one more than the expected number of arguments
22: echo "\n-- Testing array_count_values() function with more than expected no. of arguments --\n";
23: $input = array(1, 2);
24: $extra_arg = 10;
25: var_dump( array_count_values($input, $extra_arg) );
26:
27: //Test array_count_values with integer arguments
28: echo "\n-- Testing array_count_values() function integer arguments --\n";
29: var_dump( array_count_values(1 ));
30:
31: echo "Done";
32: ?>
33: --EXPECTF--
34: *** Testing array_count_values() : error conditions ***
35:
36: -- Testing array_count_values() function with Zero arguments --
37:
38: Warning: array_count_values() expects exactly 1 parameter, 0 given in %sarray_count_values_error.php on line 16
39: NULL
40:
41: -- Testing array_count_values() function with more than expected no. of arguments --
42:
43: Warning: array_count_values() expects exactly 1 parameter, 2 given in %sarray_count_values_error.php on line 22
44: NULL
45:
46: -- Testing array_count_values() function integer arguments --
47:
48: Warning: array_count_values() expects parameter 1 to be array, integer given in %sarray_count_values_error.php on line 26
49: NULL
50: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>