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