Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setSalesChannelDomains example
$this
->
createMock
(
SalesChannelContext::
class
)
)
;
}
public
function
testSwitchCustomerChange
(
)
: void
{
$language
=
new
LanguageEntity
(
)
;
$language
->
setUniqueIdentifier
(
Uuid::
randomHex
(
)
)
;
$scDomain
=
new
SalesChannelDomainEntity
(
)
;
$scDomain
->
setUniqueIdentifier
(
Uuid::
randomHex
(
)
)
;
$scDomain
->
setUrl
(
'http://localhost'
)
;
$language
->
setSalesChannelDomains
(
new
SalesChannelDomainCollection
(
[
$scDomain
]
)
)
;
$changeLangMock
=
$this
->
createMock
(
AbstractChangeLanguageRoute::
class
)
;
$routerMock
=
$this
->
createMock
(
RouterInterface::
class
)
;
$routerMock
->
expects
(
static
::
once
(
)
)
->
method
(
'getContext'
)
->
willReturn
(
new
RequestContext
(
)
)
;
$routerMock
->
expects
(
static
::
once
(
)
)
->
method
(
'generate'
)
->
willReturn
(
'http://localhost'
)
;
$requestStackMock
=
$this
->
createMock
(
RequestStack::
class
)
;
$requestStackMock
->
expects
(
static
::
exactly
(
2
)
)
->
method
(
'getMainRequest'
)
->
willReturn
(
new
Request
(
)
)
;
$contextSwitchRoute
=
$this
->
createMock
(
ContextSwitchRoute::
class
)
;
$contextSwitchRoute
->
expects
(
static
::
once
(
)
)
->
method
(
'switchContext'
)
->
willReturn
(