Annotation of embedaddon/php/ext/standard/tests/array/array_unshift_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_unshift() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
6: * Description: Pushes elements onto the beginning of the array
7: * Source code: ext/standard/array.c
8: */
9:
10: echo "*** Testing array_unshift() : error conditions ***\n";
11:
12: // Zero arguments
13: echo "\n-- Testing array_unshift() function with Zero arguments --\n";
14: var_dump( array_unshift() );
15:
16: // Testing array_unshift with one less than the expected number of arguments
17: echo "\n-- Testing array_unshift() function with less than expected no. of arguments --\n";
18: $array = array(1, 2);
19: var_dump( array_unshift($array) );
20: echo "Done";
21: ?>
22: --EXPECTF--
23: *** Testing array_unshift() : error conditions ***
24:
25: -- Testing array_unshift() function with Zero arguments --
26:
27: Warning: array_unshift() expects at least 2 parameters, 0 given in %s on line %d
28: NULL
29:
30: -- Testing array_unshift() function with less than expected no. of arguments --
31:
32: Warning: array_unshift() expects at least 2 parameters, 1 given in %s on line %d
33: NULL
34: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>