Annotation of embedaddon/php/ext/standard/tests/array/current_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test current() function : error conditions - Pass incorrect number of args
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : mixed current(array $array_arg)
! 6: * Description: Return the element currently pointed to by the internal array pointer
! 7: * Source code: ext/standard/array.c
! 8: * Alias to functions: pos
! 9: */
! 10:
! 11: /*
! 12: * Pass incorrect number of arguments to current() to test behaviour
! 13: */
! 14:
! 15: echo "*** Testing current() : error conditions ***\n";
! 16:
! 17: // Zero arguments
! 18: echo "\n-- Testing current() function with Zero arguments --\n";
! 19: var_dump( current() );
! 20:
! 21: //Test current with one more than the expected number of arguments
! 22: echo "\n-- Testing current() function with more than expected no. of arguments --\n";
! 23: $array_arg = array(1, 2);
! 24: $extra_arg = 10;
! 25: var_dump( current($array_arg, $extra_arg) );
! 26: ?>
! 27: ===DONE===
! 28: --EXPECTF--
! 29: *** Testing current() : error conditions ***
! 30:
! 31: -- Testing current() function with Zero arguments --
! 32:
! 33: Warning: current() expects exactly 1 parameter, 0 given in %s on line %d
! 34: NULL
! 35:
! 36: -- Testing current() function with more than expected no. of arguments --
! 37:
! 38: Warning: current() expects exactly 1 parameter, 2 given in %s on line %d
! 39: NULL
! 40: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>