Skip to content

Commit c044342

Browse files
Add more tests
1 parent 775e987 commit c044342

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

ext/intl/tests/rangeformatter/rangeformatter_errors.phpt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,35 @@ try {
5353
echo $exception->getMessage() . PHP_EOL;
5454
}
5555

56+
try {
57+
$nrf = IntlNumberRangeFormatter::createFromSkeleton(
58+
'invalid skeleton here',
59+
'invalid-language',
60+
IntlNumberRangeFormatter::COLLAPSE_AUTO,
61+
IntlNumberRangeFormatter::IDENTITY_FALLBACK_SINGLE_VALUE
62+
);
63+
} catch (ValueError $exception) {
64+
echo $exception->getMessage() . PHP_EOL;
65+
}
66+
67+
try {
68+
$nrf = IntlNumberRangeFormatter::createFromSkeleton(
69+
'invalid skeleton here',
70+
'ro_thisiswaytooooooooooooooooooooooooooooooooooooooooooooolongtobevaliditneedstobeatleast157characterstofailthevalidationinthelistformattercodeimplementation',
71+
IntlNumberRangeFormatter::COLLAPSE_AUTO,
72+
IntlNumberRangeFormatter::IDENTITY_FALLBACK_SINGLE_VALUE
73+
);
74+
} catch (ValueError $exception) {
75+
echo $exception->getMessage() . PHP_EOL;
76+
}
77+
5678
?>
5779
--EXPECT--
5880
Failed to create the number skeleton
5981
65811
6082
IntlNumberRangeFormatter::createFromSkeleton(): Failed to create the number skeleton: U_NUMBER_SKELETON_SYNTAX_ERROR
6183
Call to private IntlNumberRangeFormatter::__construct() from global scope
6284
IntlNumberRangeFormatter::createFromSkeleton(): Argument #3 ($collapse) must be one of IntlNumberRangeFormatter::COLLAPSE_AUTO, IntlNumberRangeFormatter::COLLAPSE_NONE, IntlNumberRangeFormatter::COLLAPSE_UNIT, or IntlNumberRangeFormatter::COLLAPSE_ALL
63-
IntlNumberRangeFormatter::createFromSkeleton(): Argument #4 ($identityFallback) must be one of IntlNumberRangeFormatter::IDENTITY_FALLBACK_SINGLE_VALUE, IntlNumberRangeFormatter::IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE, IntlNumberRangeFormatter::IDENTITY_FALLBACK_APPROXIMATELY, or IntlNumberRangeFormatter::IDENTITY_FALLBACK_RANGE
85+
IntlNumberRangeFormatter::createFromSkeleton(): Argument #4 ($identityFallback) must be one of IntlNumberRangeFormatter::IDENTITY_FALLBACK_SINGLE_VALUE, IntlNumberRangeFormatter::IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE, IntlNumberRangeFormatter::IDENTITY_FALLBACK_APPROXIMATELY, or IntlNumberRangeFormatter::IDENTITY_FALLBACK_RANGE
86+
IntlNumberRangeFormatter::createFromSkeleton(): Argument #2 ($locale) "invalid-language" is invalid
87+
IntlNumberRangeFormatter::createFromSkeleton(): Argument #2 ($locale) must be no longer than 156 characters

0 commit comments

Comments
 (0)