FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
formatphp/tests/ConfigTest.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
/
ConfigTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (34 loc) · 1.52 KB
Breadcrumbs
formatphp
/
tests
/
ConfigTest.php
Copy path
File metadata and controls
42 lines (34 loc) · 1.52 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
<?php
declare
(strict_types=
1
);
namespace
FormatPHP
\
Test
;
use
FormatPHP
\
Config
;
use
FormatPHP
\
Extractor
\
IdInterpolator
;
use
FormatPHP
\
Intl
\
Locale
;
use
Locale
as
PhpLocale
;
class
ConfigTest
extends
TestCase
{
public
function
testInstanceConstruction
():
void
{
$
locale
=
new
Locale
(
'
en-US
'
);
$
defaultLocale
=
new
Locale
(
'
en
'
);
$
defaultRichTextElements
= [
'
em
'
=>
fn
(
string
$
text
):
string
=>
'
<em class="bar">
'
.
$
text
.
'
</em>
'
,
'
strong
'
=>
fn
(
string
$
text
):
string
=>
'
<strong class="foo">
'
.
$
text
.
'
</strong>
'
,
];
$
idInterpolatorPattern
=
'
[md5:contenthash:base64:16]
'
;
$
config
=
new
Config
(
$
locale
,
$
defaultLocale
,
$
defaultRichTextElements
,
$
idInterpolatorPattern
);
$
this
->
assertSame
(
$
locale
,
$
config
->
getLocale
());
$
this
->
assertSame
(
$
defaultLocale
,
$
config
->
getDefaultLocale
());
$
this
->
assertSame
(
$
defaultRichTextElements
,
$
config
->
getDefaultRichTextElements
());
$
this
->
assertSame
(
$
idInterpolatorPattern
,
$
config
->
getIdInterpolatorPattern
());
}
public
function
testConfigDefaults
():
void
{
$
systemLocale
=
new
Locale
(PhpLocale::
getDefault
());
$
config
=
new
Config
();
$
this
->
assertSame
(
$
systemLocale
->
toString
(),
$
config
->
getLocale
()->
toString
());
$
this
->
assertNull
(
$
config
->
getDefaultLocale
());
$
this
->
assertSame
([],
$
config
->
getDefaultRichTextElements
());
$
this
->
assertSame
(IdInterpolator::
DEFAULT_ID_INTERPOLATION_PATTERN
,
$
config
->
getIdInterpolatorPattern
());
}
}
Back
|
FazBrowse Home
|
New Git URL