Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
HomeUrlProvider example
$this
->salesChannelContext->
getSalesChannel
(
)
->
getDomains
(
)
->
add
(
$domain
)
;
$domain
=
new
SalesChannelDomainEntity
(
)
;
$domain
->
setId
(
Uuid::
randomHex
(
)
)
;
$domain
->
setUrl
(
'https://test-sitemap.de/en'
)
;
$domain
->
setHreflangUseOnlyLocale
(
false
)
;
$domain
->
setLanguageId
(
$languages
->
last
(
)
->
getId
(
)
)
;
$this
->salesChannelContext->
getSalesChannel
(
)
->
getDomains
(
)
->
add
(
$domain
)
;
$homeUrlProvider
=
new
HomeUrlProvider
(
)
;
static
::
assertCount
(
1,
$homeUrlProvider
->
getUrls
(
$this
->salesChannelContext, 100
)
->
getUrls
(
)
)
;
}
public
function
testGetHomeUrlWithSalesChannelIsExistingOneDomain
(
)
: void
{
$criteria
=
new
Criteria
(
)
;
$criteria
->
addAssociation
(
'locale'
)
;
$languages
=
$this
->
getContainer
(
)
->
get
(
'language.repository'
)
->
search
(
$criteria
,
$this
->salesChannelContext->
getContext
(
)
)
->
getEntities
(
)
;
$languageId
=
$this
->salesChannelContext->
getLanguageId
(
)
;