From: Antony Dovgal Date: Wed, 15 Nov 2006 22:42:28 +0000 (+0000) Subject: add new tests X-Git-Tag: RELEASE_1_0_0RC1~994 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1063fa6a90908098fd518b6744c4eb9ff77856cd;p=php add new tests --- diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt new file mode 100644 index 0000000000..8178aa374a --- /dev/null +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -0,0 +1,40 @@ +--TEST-- +array_key_exists() tests +--FILE-- +1))); +var_dump(array_key_exists("a", array(3,2,1))); +var_dump(array_key_exists(NULL, array(5,6,7,""=>"value", 3,2,1))); +var_dump(array_key_exists(NULL, array(5,6,7,3,2,1))); +var_dump(array_key_exists(false, array(5,6,7,""=>"value", 3,2,1))); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: array_key_exists() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) + +Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) + +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt index 16419b8465..40a621fe8f 100644 --- a/ext/standard/tests/array/array_pad.phpt +++ b/ext/standard/tests/array/array_pad.phpt @@ -16,6 +16,7 @@ var_dump(array_pad(array("", -1, 2.0), 2, array())); var_dump(array_pad(array("", -1, 2.0), -3, array())); var_dump(array_pad(array("", -1, 2.0), -4, array())); var_dump(array_pad(array("", -1, 2.0), 2000000, 0)); +var_dump(array_pad("", 2000000, 0)); echo "Done\n"; ?> @@ -94,6 +95,9 @@ array(4) { Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) + +Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d +NULL Done --UEXPECTF-- Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d @@ -170,4 +174,7 @@ array(4) { Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) + +Warning: array_pad() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL Done diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt new file mode 100644 index 0000000000..1f495f4b12 --- /dev/null +++ b/ext/standard/tests/array/array_rand.phpt @@ -0,0 +1,51 @@ +--TEST-- +array_rand() tests +--FILE-- + +--EXPECTF-- +Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d +NULL +NULL + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +Warning: array_rand() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL + +Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d +NULL +array(3) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) +} +array(2) { + [0]=> + int(%d) + [1]=> + int(%d) +} +Done diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt new file mode 100644 index 0000000000..90e9039e41 --- /dev/null +++ b/ext/standard/tests/array/array_unshift.phpt @@ -0,0 +1,64 @@ +--TEST-- +array_unshift() tests +--FILE-- + +--EXPECTF-- +int(1) +array(1) { + [0]=> + string(0) "" +} + +Warning: array_unshift(): The first argument should be an array in %s on line %d +bool(false) +array(1) { + [0]=> + string(0) "" +} +int(2) +array(2) { + [0]=> + array(1) { + [0]=> + string(0) "" + } + [1]=> + string(0) "" +} +Done +--UEXPECTF-- +int(1) +array(1) { + [0]=> + unicode(0) "" +} + +Warning: array_unshift(): The first argument should be an array in %s on line %d +bool(false) +array(1) { + [0]=> + unicode(0) "" +} +int(2) +array(2) { + [0]=> + array(1) { + [0]=> + unicode(0) "" + } + [1]=> + unicode(0) "" +} +Done diff --git a/ext/standard/tests/array/array_values.phpt b/ext/standard/tests/array/array_values.phpt new file mode 100644 index 0000000000..485b9b7a37 --- /dev/null +++ b/ext/standard/tests/array/array_values.phpt @@ -0,0 +1,78 @@ +--TEST-- +array_values() tests +--FILE-- + +--EXPECTF-- +Warning: array_values() expects exactly 1 parameter, 0 given in %s on line %d +NULL +array(0) { +} + +Warning: array_values() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, object given in %s on line %d +NULL +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + float(2) + [3]=> + string(6) "asdasd" + [4]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +Done +--UEXPECTF-- +Warning: array_values() expects exactly 1 parameter, 0 given in %s on line %d +NULL +array(0) { +} + +Warning: array_values() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, object given in %s on line %d +NULL +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + float(2) + [3]=> + unicode(6) "asdasd" + [4]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +Done diff --git a/ext/standard/tests/file/statpage.phpt b/ext/standard/tests/file/statpage.phpt new file mode 100644 index 0000000000..f11be9734c --- /dev/null +++ b/ext/standard/tests/file/statpage.phpt @@ -0,0 +1,20 @@ +--TEST-- +getlastmod() and others +--FILE-- + +--EXPECTF-- +int(%d) +int(%d) +int(%d) +int(%d) +int(%d) +Done