Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ElasticsearchOutdatedIndexDetector example
$repository
=
$this
->
createMock
(
EntityRepository::
class
)
;
$repository
->
method
(
'search'
)
->
willReturn
(
$collection
)
;
$esHelper
=
$this
->
createMock
(
ElasticsearchHelper::
class
)
;
if
(
Feature::
isActive
(
'ES_MULTILINGUAL_INDEX'
)
)
{
$esHelper
->
method
(
'enabledMultilingualIndex'
)
->
willReturn
(
true
)
;
}
$detector
=
new
ElasticsearchOutdatedIndexDetector
(
$client
,
$registry
,
$esHelper
,
$this
->
createMock
(
ElasticsearchLanguageProvider::
class
)
)
;
$arr
=
$detector
->
get
(
)
;
static
::
assertNotNull
(
$arr
)
;
if
(
Feature::
isActive
(
'ES_MULTILINGUAL_INDEX'
)
)
{
static
::
assertCount
(
1,
$arr
)
;
static
::
assertCount
(
2,
$detector
->
getAllUsedIndices
(
)
)
;
}
else
{
static
::
assertCount
(
2,
$arr
)
;
static
::
assertCount
(
4,
$detector
->
getAllUsedIndices
(
)
)
;
}
}