summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_reduce_variation2.phpt
diff options
context:
space:
mode:
authorAnt Phillips <ant@php.net>2008-12-02 13:29:17 +0000
committerAnt Phillips <ant@php.net>2008-12-02 13:29:17 +0000
commitba7bc0ace477f35d645c40adcb2d6d10d321872d (patch)
treefd86eb7600e690403f63481acbcae160d59f51a6 /ext/standard/tests/array/array_reduce_variation2.phpt
parent8862c5d405860c0a5418eb9283796ec87105fbb9 (diff)
downloadphp-git-ba7bc0ace477f35d645c40adcb2d6d10d321872d.tar.gz
Array tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit).
Diffstat (limited to 'ext/standard/tests/array/array_reduce_variation2.phpt')
-rw-r--r--ext/standard/tests/array/array_reduce_variation2.phpt35
1 files changed, 35 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_reduce_variation2.phpt b/ext/standard/tests/array/array_reduce_variation2.phpt
new file mode 100644
index 0000000000..d68372f827
--- /dev/null
+++ b/ext/standard/tests/array/array_reduce_variation2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test array_reduce() function : variation - invalid parameters
+--FILE--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : variation - invalid parameters ***\n";
+
+
+$array = array(1);
+
+var_dump(array_reduce($array, "bogusbogus"));
+
+var_dump(array_reduce("bogusarray", "max"));
+
+var_dump(array_reduce(new stdClass(), "max"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_reduce() : variation - invalid parameters ***
+
+Warning: array_reduce() expects parameter 2 to be a valid callback, function 'bogusbogus' not found or invalid function name in %sarray_reduce_variation2.php on line %d
+NULL
+
+Warning: array_reduce() expects parameter 1 to be array, Unicode string given in %sarray_reduce_variation2.php on line %d
+NULL
+
+Warning: array_reduce() expects parameter 1 to be array, object given in %sarray_reduce_variation2.php on line %d
+NULL
+===DONE=== \ No newline at end of file