Annotation of embedaddon/php/ext/standard/tests/strings/str_split_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test str_split() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : array str_split(string $str [, int $split_length])
6: * Description: Convert a string to an array. If split_length is
7: specified, break the string down into chunks each
8: split_length characters long.
9: * Source code: ext/standard/string.c
10: * Alias to functions: none
11: */
12:
13: echo "*** Testing str_split() : error conditions ***\n";
14:
15: // Zero arguments
16: echo "-- Testing str_split() function with Zero arguments --\n";
17: var_dump( str_split() );
18:
19: //Test str_split with one more than the expected number of arguments
20: echo "-- Testing str_split() function with more than expected no. of arguments --\n";
21: $str = 'This is error testcase';
22: $split_length = 4;
23: $extra_arg = 10;
24: var_dump( str_split( $str, $split_length, $extra_arg) );
25:
26: echo "Done"
27: ?>
28: --EXPECTF--
29: *** Testing str_split() : error conditions ***
30: -- Testing str_split() function with Zero arguments --
31:
32: Warning: str_split() expects at least 1 parameter, 0 given in %s on line %d
33: NULL
34: -- Testing str_split() function with more than expected no. of arguments --
35:
36: Warning: str_split() expects at most 2 parameters, 3 given in %s on line %d
37: NULL
38: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>