summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_uintersect_variation5.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/array/array_uintersect_variation5.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/array/array_uintersect_variation5.phpt')
-rw-r--r--ext/standard/tests/array/array_uintersect_variation5.phpt58
1 files changed, 58 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_uintersect_variation5.phpt b/ext/standard/tests/array/array_uintersect_variation5.phpt
new file mode 100644
index 0000000..75cf08e
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_variation5.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test array_uintersect() function : usage variation - differing comparison functions
+--FILE--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_uintersect($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_uintersect($arr1, $arr2, 'too_few_parameters'));
+
+?>
+
+===DONE===
+--EXPECTF--
+*** Testing array_uintersect() : usage variation - differing comparison functions***
+
+-- comparison function with an incorrect return value --
+array(0) {
+}
+
+-- comparison function taking too many parameters --
+
+Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d
+
+Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d
+
+Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d
+array(0) {
+}
+
+-- comparison function taking too few parameters --
+array(0) {
+}
+
+===DONE===