Annotation of embedaddon/php/ext/standard/tests/array/array_unique_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_unique() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array array_unique(array $input)
! 6: * Description: Removes duplicate values from array
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: echo "*** Testing array_unique() : error conditions ***\n";
! 11:
! 12: // Zero arguments
! 13: echo "\n-- Testing array_unique() function with zero arguments --\n";
! 14: var_dump( array_unique() );
! 15:
! 16: //Test array_unique with one more than the expected number of arguments
! 17: echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
! 18: $input = array(1, 2);
! 19: $extra_arg = 10;
! 20: var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) );
! 21:
! 22: echo "Done";
! 23: ?>
! 24: --EXPECTF--
! 25: *** Testing array_unique() : error conditions ***
! 26:
! 27: -- Testing array_unique() function with zero arguments --
! 28:
! 29: Warning: array_unique() expects at least 1 parameter, 0 given in %s on line %d
! 30: NULL
! 31:
! 32: -- Testing array_unique() function with more than expected no. of arguments --
! 33:
! 34: Warning: array_unique() expects at most 2 parameters, 3 given in %s on line %d
! 35: NULL
! 36: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>