Annotation of embedaddon/php/ext/standard/tests/array/array_pad_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_pad() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
! 6: * Description: Returns a copy of input array padded with pad_value to size pad_size
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: echo "*** Testing array_pad() : error conditions ***\n";
! 11:
! 12: // Zero arguments
! 13: echo "\n-- Testing array_pad() function with Zero arguments --\n";
! 14: var_dump( array_pad() );
! 15:
! 16: //Test array_pad with one more than the expected number of arguments
! 17: echo "\n-- Testing array_pad() function with more than expected no. of arguments --\n";
! 18: $input = array(1, 2);
! 19: $pad_size = 10;
! 20: $pad_value = 1;
! 21: $extra_arg = 10;
! 22: var_dump( array_pad($input, $pad_size, $pad_value, $extra_arg) );
! 23:
! 24: // Testing array_pad with less than the expected number of arguments
! 25: echo "\n-- Testing array_pad() function with less than expected no. of arguments --\n";
! 26: $input = array(1, 2);
! 27: $pad_size = 10;
! 28: var_dump( array_pad($input, $pad_size) );
! 29: var_dump( array_pad($input) );
! 30:
! 31: echo "Done";
! 32: ?>
! 33: --EXPECTF--
! 34: *** Testing array_pad() : error conditions ***
! 35:
! 36: -- Testing array_pad() function with Zero arguments --
! 37:
! 38: Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d
! 39: NULL
! 40:
! 41: -- Testing array_pad() function with more than expected no. of arguments --
! 42:
! 43: Warning: array_pad() expects exactly 3 parameters, 4 given in %s on line %d
! 44: NULL
! 45:
! 46: -- Testing array_pad() function with less than expected no. of arguments --
! 47:
! 48: Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d
! 49: NULL
! 50:
! 51: Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d
! 52: NULL
! 53: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>