Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getHashes example
$context
= Context::
createDefaultContext
(
)
;
$productId
=
$this
->
createProduct
(
$context
)
;
$result
=
$this
->loader->
load
(
$productId
,
$context
, TestDefaults::SALES_CHANNEL
)
;
foreach
(
$result
->
getCombinations
(
)
as
$combinationHash
=>
$combination
)
{
static
::
assertTrue
(
$result
->
hasCombination
(
$combination
)
)
;
foreach
(
$combination
as
$optionId
)
{
static
::
assertTrue
(
$result
->
hasOptionId
(
$optionId
)
)
;
}
static
::
assertTrue
(
\
in_array
(
$combinationHash
,
$result
->
getHashes
(
)
, true
)
)
;
}
}
public
function
testCombinationsAreInResult
(
)
: void
{
$context
= Context::
createDefaultContext
(
)
;
$salesChanelContext
= Generator::
createSalesChannelContext
(
$context
)
;
$productId
=
$this
->
createProduct
(
$context
)
;
$result
=
$this
->loader->
loadCombinations
(
$productId
,
$salesChanelContext
)
;
foreach
(
$result
->
getCombinations
(
)
as
$combinationHash
=>
$combination
)
{