Annotation of embedaddon/php/ext/standard/tests/array/array_pop_errors.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_pop() function (errors)
3: --FILE--
4: <?php
5:
6: $empty_array = array();
7: $number = 5;
8: $str = "abc";
9:
10:
11: /* Various combinations of arrays to be used for the test */
12: $mixed_array = array(
13: array(),
14: array( 1,2,3,4,5,6,7,8,9 ),
15: array( "One", "_Two", "Three", "Four", "Five" ),
16: array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
17: array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
18: array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
19: array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
20: array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
21: "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
22: array( 12, "name", 'age', '45' ),
23: array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
24: array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
25: 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
26: );
27:
28: /* Testing Error Conditions */
29: echo "\n*** Testing Error Conditions ***\n";
30:
31: /* Zero argument */
32: var_dump( array_pop() );
33:
34: /* Scalar argument */
35: var_dump( array_pop($number) );
36:
37: /* String argument */
38: var_dump( array_pop($str) );
39:
40: /* Invalid Number of arguments */
41: var_dump( array_pop($mixed_array[1],$mixed_array[2]) );
42:
43: /* Empty Array as argument */
44: var_dump( array_pop($empty_array) );
45:
46: echo"\nDone";
47: ?>
48: --EXPECTF--
49: *** Testing Error Conditions ***
50:
51: Warning: array_pop() expects exactly 1 parameter, 0 given in %s on line %d
52: NULL
53:
54: Warning: array_pop() expects parameter 1 to be array, integer given in %s on line %d
55: NULL
56:
57: Warning: array_pop() expects parameter 1 to be array, string given in %s on line %d
58: NULL
59:
60: Warning: array_pop() expects exactly 1 parameter, 2 given in %s on line %d
61: NULL
62: NULL
63:
64: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>