Annotation of embedaddon/php/ext/standard/tests/array/array_uintersect_variation5.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_uintersect() function : usage variation - differing comparison functions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
! 6: * 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.
! 7: * Source code: ext/standard/array.c
! 8: * Alias to functions:
! 9: */
! 10:
! 11: echo "*** Testing array_uintersect() : usage variation - differing comparison functions***\n";
! 12:
! 13: $arr1 = array(1);
! 14: $arr2 = array(1,2);
! 15:
! 16: echo "\n-- comparison function with an incorrect return value --\n";
! 17: function incorrect_return_value ($val1, $val2) {
! 18: return array(1);
! 19: }
! 20: var_dump(array_uintersect($arr1, $arr2, 'incorrect_return_value'));
! 21:
! 22: echo "\n-- comparison function taking too many parameters --\n";
! 23: function too_many_parameters ($val1, $val2, $val3) {
! 24: return 1;
! 25: }
! 26: var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters'));
! 27:
! 28: echo "\n-- comparison function taking too few parameters --\n";
! 29: function too_few_parameters ($val1) {
! 30: return 1;
! 31: }
! 32: var_dump(array_uintersect($arr1, $arr2, 'too_few_parameters'));
! 33:
! 34: ?>
! 35:
! 36: ===DONE===
! 37: --EXPECTF--
! 38: *** Testing array_uintersect() : usage variation - differing comparison functions***
! 39:
! 40: -- comparison function with an incorrect return value --
! 41: array(0) {
! 42: }
! 43:
! 44: -- comparison function taking too many parameters --
! 45:
! 46: Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d
! 47:
! 48: Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d
! 49:
! 50: Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d
! 51: array(0) {
! 52: }
! 53:
! 54: -- comparison function taking too few parameters --
! 55: array(0) {
! 56: }
! 57:
! 58: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>