Annotation of embedaddon/php/ext/standard/tests/array/array_chunk_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_chunk() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array array_chunk(array input, int size [, bool preserve_keys])
! 6: * Description: Split array into chunks
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: echo "*** Testing array_chunk() : error conditions ***\n";
! 11:
! 12: // Zero arguments
! 13: echo "\n-- Testing array_chunk() function with zero arguments --\n";
! 14: var_dump( array_chunk() );
! 15:
! 16: echo "\n-- Testing array_chunk() function with more than expected no. of arguments --\n";
! 17: $input = array(1, 2);
! 18: $size = 10;
! 19: $preserve_keys = true;
! 20: $extra_arg = 10;
! 21: var_dump( array_chunk($input,$size,$preserve_keys, $extra_arg) );
! 22:
! 23: echo "\n-- Testing array_chunk() function with less than expected no. of arguments --\n";
! 24: $input = array(1, 2);
! 25: var_dump( array_chunk($input) );
! 26:
! 27: echo "Done";
! 28: ?>
! 29: --EXPECTF--
! 30: *** Testing array_chunk() : error conditions ***
! 31:
! 32: -- Testing array_chunk() function with zero arguments --
! 33:
! 34: Warning: array_chunk() expects at least 2 parameters, 0 given in %s on line %d
! 35: NULL
! 36:
! 37: -- Testing array_chunk() function with more than expected no. of arguments --
! 38:
! 39: Warning: array_chunk() expects at most 3 parameters, 4 given in %s on line %d
! 40: NULL
! 41:
! 42: -- Testing array_chunk() function with less than expected no. of arguments --
! 43:
! 44: Warning: array_chunk() expects at least 2 parameters, 1 given in %s on line %d
! 45: NULL
! 46: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>