Annotation of embedaddon/php/ext/standard/tests/array/array_intersect_key_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_intersect_key() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
6: * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
7: * Source code: ext/standard/array.c
8: */
9:
10: echo "*** Testing array_intersect_key() : error conditions ***\n";
11:
12: //Initialise function arguments
13: $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
14:
15: // Testing array_intersect_key with one less than the expected number of arguments
16: echo "\n-- Testing array_intersect_key() function with less than expected no. of arguments --\n";
17: var_dump( array_intersect_key($array1) );
18:
19: // Testing array_intersect_key with one less than the expected number of arguments
20: echo "\n-- Testing array_intersect_key() function with no arguments --\n";
21: var_dump( array_intersect_key() );
22: ?>
23: ===DONE===
24: --EXPECTF--
25: *** Testing array_intersect_key() : error conditions ***
26:
27: -- Testing array_intersect_key() function with less than expected no. of arguments --
28:
29: Warning: array_intersect_key(): at least 2 parameters are required, 1 given in %s on line %d
30: NULL
31:
32: -- Testing array_intersect_key() function with no arguments --
33:
34: Warning: array_intersect_key(): at least 2 parameters are required, 0 given in %s on line %d
35: NULL
36: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>