Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
removeMapping example
$event
=
new
ElasticsearchProductCustomFieldsMappingEvent
(
[
'field1' => 'text'
]
,
$context
)
;
static
::
assertSame
(
$context
,
$event
->
getContext
(
)
)
;
static
::
assertSame
(
'text',
$event
->
getMapping
(
'field1'
)
)
;
static
::
assertNull
(
$event
->
getMapping
(
'field2'
)
)
;
$event
->
setMapping
(
'field2', 'text'
)
;
static
::
assertSame
(
'text',
$event
->
getMapping
(
'field2'
)
)
;
$event
->
removeMapping
(
'field2'
)
;
static
::
assertNull
(
$event
->
getMapping
(
'field2'
)
)
;
$mappings
=
$event
->
getMappings
(
)
;
static
::
assertEquals
(
[
'field1' => 'text'
]
,
$mappings
)
;
}
}