Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
IndexCreator example
// Alias does not exists, swap directly
$indices
->
expects
(
static
::
once
(
)
)
->
method
(
'existsAlias'
)
->
with
(
[
'name' => 'bla'
]
)
->
willReturn
(
false
)
;
$indices
->
expects
(
static
::
once
(
)
)
->
method
(
'refresh'
)
->
with
(
[
'index' => 'foo'
]
)
;
$indices
->
expects
(
static
::
once
(
)
)
->
method
(
'putAlias'
)
->
with
(
[
'index' => 'foo', 'name' => 'bla'
]
)
;
$client
->
method
(
'indices'
)
->
willReturn
(
$indices
)
;
$index
=
new
IndexCreator
(
$client
,
[
'settings' =>
$constructorConfig
,
]
,
$this
->
createMock
(
IndexMappingProvider::
class
)
,
new
EventDispatcher
(
)
)
;
$definition
=
$this
->
createMock
(
ElasticsearchProductDefinition::
class
)
;
$index
->
createIndex
(
$definition
, 'foo', 'bla', Context::
createDefaultContext
(
)
)
;
}