Annotation of embedaddon/php/ext/mbstring/tests/mb_split_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test mb_split() function : error conditions
3: --SKIPIF--
4: <?php
5: extension_loaded('mbstring') or die('skip');
6: function_exists('mb_split') or die("skip mb_split() is not available in this build");
7: ?>
8: --FILE--
9: <?php
10: /* Prototype : proto array mb_split(string pattern, string string [, int limit])
11: * Description: split multibyte string into array by regular expression
12: * Source code: ext/mbstring/php_mbregex.c
13: * Alias to functions:
14: */
15:
16: /*
17: * test too few and too many parameters
18: */
19:
20: echo "*** Testing mb_split() : error conditions ***\n";
21:
22:
23: //Test mb_split with one more than the expected number of arguments
24: echo "\n-- Testing mb_split() function with more than expected no. of arguments --\n";
25: $pattern = ' ';
26: $string = 'a b c d e f g';
27: $limit = 0;
28: $extra_arg = 10;
29: var_dump( mb_split($pattern, $string, $limit, $extra_arg) );
30:
31: // Testing mb_split with one less than the expected number of arguments
32: echo "\n-- Testing mb_split() function with less than expected no. of arguments --\n";
33: $pattern = 'string_val';
34: var_dump( mb_split($pattern) );
35:
36: echo "Done";
37: ?>
38: --EXPECTF--
39: *** Testing mb_split() : error conditions ***
40:
41: -- Testing mb_split() function with more than expected no. of arguments --
42:
43: Warning: mb_split() expects at most 3 parameters, 4 given in %s on line %d
44: bool(false)
45:
46: -- Testing mb_split() function with less than expected no. of arguments --
47:
48: Warning: mb_split() expects at least 2 parameters, 1 given in %s on line %d
49: bool(false)
50: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>