Annotation of embedaddon/php/ext/mbstring/tests/mb_strtolower_error1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test mb_strtolower() function : error conditions - pass incorrect number of arguments
3: --SKIPIF--
4: <?php
5: extension_loaded('mbstring') or die('skip');
6: function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
7: ?>
8: --FILE--
9: <?php
10: /* Prototype : string mb_strtolower(string $sourcestring [, string $encoding])
11: * Description: Returns a lowercased version of $sourcestring
12: * Source code: ext/mbstring/mbstring.c
13: */
14:
15: /*
16: * Pass an incorrect number of arguments to mb_strtolower() to test behaviour
17: */
18:
19: echo "*** Testing mb_strtolower() : error conditions***\n";
20:
21: //Test mb_strtolower with one more than the expected number of arguments
22: echo "\n-- Testing mb_strtolower() function with more than expected no. of arguments --\n";
23: $sourcestring = 'string_value';
24: $encoding = 'UTF-8';
25: $extra_arg = 10;
26: var_dump( mb_strtolower($sourcestring, $encoding, $extra_arg) );
27:
28: //Test mb_strtolower with zero arguments
29: echo "\n-- Testing mb_strtolower() function with zero arguments --\n";
30: var_dump( mb_strtolower() );
31:
32: echo "Done";
33: ?>
34: --EXPECTF--
35: *** Testing mb_strtolower() : error conditions***
36:
37: -- Testing mb_strtolower() function with more than expected no. of arguments --
38:
39: Warning: mb_strtolower() expects at most 2 parameters, 3 given in %s on line %d
40: NULL
41:
42: -- Testing mb_strtolower() function with zero arguments --
43:
44: Warning: mb_strtolower() expects at least 1 parameter, 0 given in %s on line %d
45: NULL
46: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>