diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:39:08 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:39:08 -0400 |
| commit | 993e1866df547532a05ab6db76c9ff5aefc9a3df (patch) | |
| tree | 169d3bde0974235d3cde164786ef6f381a4749a7 /ext/mbstring/tests/mb_substr_error1.phpt | |
| parent | 1f589a2bd44ba835ad1b009a5d83abd453724829 (diff) | |
| download | php-upstream/5.2.6.tar.gz | |
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'ext/mbstring/tests/mb_substr_error1.phpt')
| -rw-r--r-- | ext/mbstring/tests/mb_substr_error1.phpt | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/ext/mbstring/tests/mb_substr_error1.phpt b/ext/mbstring/tests/mb_substr_error1.phpt new file mode 100644 index 000000000..c2007c93b --- /dev/null +++ b/ext/mbstring/tests/mb_substr_error1.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test mb_substr() function : error conditions - Pass incorrect number of args +--SKIPIF-- +<?php +extension_loaded('mbstring') or die('skip'); +function_exists('mb_substr') or die("skip mb_substr() is not available in this build"); +?> +--FILE-- +<?php +/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]]) + * Description: Returns part of a string + * Source code: ext/mbstring/mbstring.c + */ + +/* + * Pass incorrect number of arguments to mb_substr() to test behaviour + */ + +echo "*** Testing mb_substr() : error conditions ***\n"; + +//Test mb_substr with one more than the expected number of arguments +echo "\n-- Testing mb_substr() function with more than expected no. of arguments --\n"; +$str = 'string_val'; +$start = 10; +$length = 10; +$encoding = 'string_val'; +$extra_arg = 10; +var_dump( mb_substr($str, $start, $length, $encoding, $extra_arg) ); + +// Testing mb_substr with one less than the expected number of arguments +echo "\n-- Testing mb_substr() function with less than expected no. of arguments --\n"; +$str = 'string_val'; +var_dump( mb_substr($str) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing mb_substr() : error conditions *** + +-- Testing mb_substr() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for mb_substr() in %s on line %d +NULL + +-- Testing mb_substr() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for mb_substr() in %s on line %d +NULL +Done |
