Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DummyLocaleAware example
protected
function
tearDown
(
)
: void
{
parent::
tearDown
(
)
;
\Locale::
setDefault
(
$this
->intlLocale
)
;
}
public
function
testCanSwitchLocale
(
)
{
\Locale::
setDefault
(
'en'
)
;
$service
=
new
DummyLocaleAware
(
'en'
)
;
$switcher
=
new
LocaleSwitcher
(
'en',
[
$service
]
)
;
$this
->
assertSame
(
'en', \Locale::
getDefault
(
)
)
;
$this
->
assertSame
(
'en',
$service
->
getLocale
(
)
)
;
$this
->
assertSame
(
'en',
$switcher
->
getLocale
(
)
)
;
$switcher
->
setLocale
(
'fr'
)
;
$this
->
assertSame
(
'fr', \Locale::
getDefault
(
)
)
;
$this
->
assertSame
(
'fr',
$service
->
getLocale
(
)
)
;
$this
->
assertSame
(
'fr',
$switcher
->
getLocale
(
)
)
;
}