FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
formatphp/tests/Intl/DisplayNamesTest.php at main · formatphp/formatphp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
formatphp
/
formatphp
Public
forked from
Skillshare/formatphp
Notifications
You must be signed in to change notification settings
Fork
0
Star
3
Code
Issues
0
Pull requests
1
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
formatphp
/
tests
/
Intl
/
DisplayNamesTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (49 loc) · 1.87 KB
Breadcrumbs
formatphp
/
tests
/
Intl
/
DisplayNamesTest.php
Copy path
File metadata and controls
56 lines (49 loc) · 1.87 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
declare
(strict_types=
1
);
namespace
FormatPHP
\
Test
\
Intl
;
use
FormatPHP
\
Exception
\
UnableToFormatDisplayNameException
;
use
FormatPHP
\
Intl
\
DisplayNames
;
use
FormatPHP
\
Intl
\
DisplayNamesOptions
;
use
FormatPHP
\
Intl
\
Locale
;
use
FormatPHP
\
Test
\
TestCase
;
use
PHPUnit
\
Framework
\
Attributes
\
DataProvider
;
class
DisplayNamesTest
extends
TestCase
{
/**
* @param "region" | "script" $type
*/
#[DataProvider(
'
invalidValueProvider
'
)]
public
function
testThrowsExceptionForInvalidValue
(
string
$
value
,
string
$
type
):
void
{
$
locale
=
new
Locale
(
'
en-US
'
);
$
options
=
new
DisplayNamesOptions
([
'
type
'
=>
$
type
]);
$
displayNames
=
new
DisplayNames
(
$
locale
,
$
options
);
$
this
->
expectException
(UnableToFormatDisplayNameException::class);
$
this
->
expectExceptionMessage
(
"
Invalid value
\"
$
value
\"
for option
$
type
"
);
$
displayNames
->
of
(
$
value
);
}
/**
* @return array<array{value: string, type: string}>
*/
public
static
function
invalidValueProvider
():
array
{
return
[
[
'
value
'
=>
'
A
'
,
'
type
'
=>
'
region
'
],
[
'
value
'
=>
'
a
'
,
'
type
'
=>
'
region
'
],
[
'
value
'
=>
'
AAA
'
,
'
type
'
=>
'
region
'
],
[
'
value
'
=>
'
aaa
'
,
'
type
'
=>
'
region
'
],
[
'
value
'
=>
'
1
'
,
'
type
'
=>
'
region
'
],
[
'
value
'
=>
'
12
'
,
'
type
'
=>
'
region
'
],
[
'
value
'
=>
'
1234
'
,
'
type
'
=>
'
region
'
],
[
'
value
'
=>
'
A
'
,
'
type
'
=>
'
script
'
],
[
'
value
'
=>
'
Ab
'
,
'
type
'
=>
'
script
'
],
[
'
value
'
=>
'
Abc
'
,
'
type
'
=>
'
script
'
],
[
'
value
'
=>
'
Abcde
'
,
'
type
'
=>
'
script
'
],
[
'
value
'
=>
'
Abc1
'
,
'
type
'
=>
'
script
'
],
[
'
value
'
=>
'
a
'
,
'
type
'
=>
'
currency
'
],
[
'
value
'
=>
'
ab
'
,
'
type
'
=>
'
currency
'
],
[
'
value
'
=>
'
abcd
'
,
'
type
'
=>
'
currency
'
],
[
'
value
'
=>
'
ab1
'
,
'
type
'
=>
'
currency
'
],
];
}
}
Back
|
FazBrowse Home
|
New Git URL