Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
switchLanguage example
public
function
testSwitchLangNoArgument
(
)
: void
{
$controller
=
new
ContextController
(
$this
->
createMock
(
ContextSwitchRoute::
class
)
,
$this
->
createMock
(
RequestStack::
class
)
,
$this
->
createMock
(
RouterInterface::
class
)
)
;
$this
->
expectException
(
RoutingException::
class
)
;
$this
->
expectExceptionMessage
(
'Parameter "languageId" is missing.'
)
;
$controller
->
switchLanguage
(
new
Request
(
)
,
$this
->
createMock
(
SalesChannelContext::
class
)
)
;
}
public
function
testSwitchLangNotFound
(
)
: void
{
$contextSwitchRoute
=
$this
->
createMock
(
ContextSwitchRoute::
class
)
;
$contextSwitchRoute
->
expects
(
static
::
once
(
)
)
->
method
(
'switchContext'
)
->
willThrowException
(
new
ConstraintViolationException
(
new
ConstraintViolationList
(
)
,
[
]
)
)
;
$controller
=
new
ContextController
(
$contextSwitchRoute
,
$this
->
createMock
(
RequestStack::
class
)
,