Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getProductMediaCollection example
$slot
->
setFieldConfig
(
new
FieldConfigCollection
(
)
)
;
$this
->imageSliderResolver->
enrich
(
$slot
,
$resolverContext
,
$result
)
;
$imageSliderStruct
=
$slot
->
getData
(
)
;
static
::
assertInstanceOf
(
ImageSliderStruct::
class
,
$imageSliderStruct
)
;
static
::
assertEmpty
(
$imageSliderStruct
->
getSliderItems
(
)
)
;
}
public
function
testEnrichWithMappedConfigAndHasCorrectOrder
(
)
: void
{
$productMediaCollection
=
$this
->
getProductMediaCollection
(
)
;
$resolverContext
=
$this
->
getResolverContext
(
$productMediaCollection
)
;
$result
=
$this
->
getEntitySearchResult
(
$productMediaCollection
,
$resolverContext
)
;
$fieldConfig
=
new
FieldConfigCollection
(
)
;
$fieldConfig
->
add
(
new
FieldConfig
(
'sliderItems', FieldConfig::SOURCE_MAPPED, 'product.media'
)
)
;
$slot
=
new
CmsSlotEntity
(
)
;
$slot
->
setUniqueIdentifier
(
'id'
)
;
$slot
->
setType
(
'image-slider'
)
;
$slot
->
setFieldConfig
(
$fieldConfig
)
;