1--TEST--
2Test mb_strtoupper() function : usage varitations - Pass different character types to check conversion is correct
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 characters from different languages to check that mb_strtoupper is
17 * doing a correct case conversion
18 */
19
20echo "*** Testing mb_strtoupper() : usage variations ***\n";
21
22$uppers = array('Basic Latin' => b'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
23                'Characters With Accents' => base64_decode('w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=='),
24                'Russian' => base64_decode('0JDQkdCS0JPQlNCV0JbQlw=='));
25$lowers = array('Basic Latin' => b'abcdefghijklmnopqrstuvwxyz',
26                'Characters With Accents' => base64_decode('w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=='),
27                'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
28
29foreach ($lowers as $lang => $sourcestring) {
30	echo "\n-- $lang --\n";
31	$a = mb_strtoupper($sourcestring, 'UTF-8');
32	var_dump(base64_encode($a));
33	if ($a == $uppers[$lang]) {
34		echo "Correctly Converted\n";
35	} else {
36		echo "Incorrectly Converted\n";
37	}
38}
39
40echo "Done";
41?>
42
43--EXPECTF--
44*** Testing mb_strtoupper() : usage variations ***
45
46-- Basic Latin --
47string(36) "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo="
48Correctly Converted
49
50-- Characters With Accents --
51string(64) "w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=="
52Correctly Converted
53
54-- Russian --
55string(24) "0JDQkdCS0JPQlNCV0JbQlw=="
56Correctly Converted
57Done