xref: /php-src/ext/intl/tests/gh12282.phpt (revision 683e7878)
1--TEST--
2GitHub #12282 IntlDateFormatter::locale with invalid value.
3--EXTENSIONS--
4intl
5--FILE--
6<?php
7
8try {
9    new IntlDateFormatter(
10	    'xx',
11	    IntlDateFormatter::FULL,
12	    IntlDateFormatter::FULL,
13	    null,
14	    null,
15	    'w'
16    );
17} catch (\ValueError $e) {
18    echo $e->getMessage() . PHP_EOL;
19}
20
21Locale::setDefault('xx');
22try {
23    new IntlDateFormatter(Locale::getDefault());
24} catch (\ValueError $e) {
25    echo $e->getMessage();
26}
27--EXPECT--
28IntlDateFormatter::__construct(): Argument #1 ($locale) "xx" is invalid
29IntlDateFormatter::__construct(): Argument #1 ($locale) "xx" is invalid
30