xref: /PHP-8.0/ext/mbstring/tests/mb_language.phpt (revision 07062e1f)
1--TEST--
2mb_language()
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip');
5--INI--
6mbstring.language=
7--FILE--
8<?php
9echo "Checking default language:\n";
10var_dump(mb_language());
11
12echo "Checking default language after ini_set:\n";
13ini_set('mbstring.language', 'uni');
14var_dump(mb_language());
15
16echo "Changing language to English should be successful:\n";
17var_dump(mb_language('English'));
18
19echo "Confirm language was changed:\n";
20var_dump(mb_language());
21
22echo "Try changing to a non-existent language:\n";
23try {
24    var_dump(mb_language('Pig Latin'));
25} catch (\ValueError $e) {
26    echo $e->getMessage() . \PHP_EOL;
27}
28var_dump(mb_language());
29?>
30--EXPECT--
31Checking default language:
32string(7) "neutral"
33Checking default language after ini_set:
34string(3) "uni"
35Changing language to English should be successful:
36bool(true)
37Confirm language was changed:
38string(7) "English"
39Try changing to a non-existent language:
40mb_language(): Argument #1 ($language) must be a valid language, "Pig Latin" given
41string(7) "neutral"
42