Annotation of embedaddon/php/ext/standard/tests/array/array_rand.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: array_rand() tests
3: --FILE--
4: <?php
5:
6: var_dump(array_rand());
7: var_dump(array_rand(array()));
8: var_dump(array_rand(array(), 0));
9: var_dump(array_rand(0, 0));
10: var_dump(array_rand(array(1,2,3), 0));
11: var_dump(array_rand(array(1,2,3), -1));
12: var_dump(array_rand(array(1,2,3), 10));
13: var_dump(array_rand(array(1,2,3), 3));
14: var_dump(array_rand(array(1,2,3), 2));
15:
16: echo "Done\n";
17: ?>
18: --EXPECTF--
19: Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d
20: NULL
21: NULL
22:
23: Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
24: NULL
25:
26: Warning: array_rand() expects parameter 1 to be array, integer given in %s on line %d
27: NULL
28:
29: Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
30: NULL
31:
32: Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
33: NULL
34:
35: Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
36: NULL
37: array(3) {
38: [0]=>
39: int(%d)
40: [1]=>
41: int(%d)
42: [2]=>
43: int(%d)
44: }
45: array(2) {
46: [0]=>
47: int(%d)
48: [1]=>
49: int(%d)
50: }
51: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>