Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setUpCurrentLanguage example
/** * Tests the getPathByAlias method for an alias that have a matching path. * * @covers ::getPathByAlias */
public
function
testGetPathByAliasMatch
(
)
{
$alias
=
$this
->
randomMachineName
(
)
;
$path
=
$this
->
randomMachineName
(
)
;
$language
=
$this
->
setUpCurrentLanguage
(
)
;
$this
->aliasRepository->
expects
(
$this
->
once
(
)
)
->
method
(
'lookupByAlias'
)
->
with
(
$alias
,
$language
->
getId
(
)
)
->
willReturn
(
[
'path' =>
$path
]
)
;
$this
->
assertEquals
(
$path
,
$this
->aliasManager->
getPathByAlias
(
$alias
)
)
;
// Call it twice to test the static cache.
$this
->
assertEquals
(
$path
,
$this
->aliasManager->
getPathByAlias
(
$alias
)
)
;
}