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