Annotation of embedaddon/php/ext/standard/tests/strings/explode_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test explode() function : error conditions
! 3: --FILE--
! 4: <?php
! 5:
! 6: /* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
! 7: * Description: Split a string by string.
! 8: * Source code: ext/standard/string.c
! 9: */
! 10:
! 11: echo "*** Testing explode() : error conditions ***\n";
! 12:
! 13: echo "\n-- Testing explode() function with no arguments --\n";
! 14: var_dump( explode() );
! 15:
! 16: echo "\n-- Testing explode() function with more than expected no. of arguments --\n";
! 17: $delimeter = " ";
! 18: $string = "piece1 piece2 piece3 piece4 piece5 piece6";
! 19: $limit = 5;
! 20: $extra_arg = 10;
! 21: var_dump( explode($delimeter, $string, $limit, $extra_arg) );
! 22:
! 23: ?>
! 24: ===Done===
! 25: --EXPECTF--
! 26: *** Testing explode() : error conditions ***
! 27:
! 28: -- Testing explode() function with no arguments --
! 29:
! 30: Warning: explode() expects at least 2 parameters, 0 given in %s on line %d
! 31: NULL
! 32:
! 33: -- Testing explode() function with more than expected no. of arguments --
! 34:
! 35: Warning: explode() expects at most 3 parameters, 4 given in %s on line %d
! 36: NULL
! 37: ===Done===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>