Annotation of embedaddon/php/ext/standard/tests/array/array_diff_assoc_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_diff_assoc() function : error conditions - pass array_diff_assoc() too few/zero arguments
3: --FILE--
4: <?php
5: /* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
6: * Description: Returns the entries of arr1 that have values which are not present
7: * in any of the others arguments but do additional checks whether the keys are equal
8: * Source code: ext/standard/array.c
9: */
10:
11: /*
12: * Test errors for array_diff with too few\zero arguments
13: */
14:
15: echo "*** Testing array_diff_assoc() : error conditions ***\n";
16:
17: // Zero arguments
18: echo "\n-- Testing array_diff_assoc() function with zero arguments --\n";
19: var_dump( array_diff_assoc() );
20:
21: // Testing array_diff_assoc with one less than the expected number of arguments
22: echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n";
23: $arr1 = array(1, 2);
24: var_dump( array_diff_assoc($arr1) );
25:
26:
27: echo "Done";
28: ?>
29: --EXPECTF--
30: *** Testing array_diff_assoc() : error conditions ***
31:
32: -- Testing array_diff_assoc() function with zero arguments --
33:
34: Warning: array_diff_assoc(): at least 2 parameters are required, 0 given in %s on line %d
35: NULL
36:
37: -- Testing array_diff_assoc() function with less than expected no. of arguments --
38:
39: Warning: array_diff_assoc(): at least 2 parameters are required, 1 given in %s on line %d
40: NULL
41: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>