Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
NoNodesAvailableException example
public
function
testExceptionsGetLogged
(
)
: void
{
$criteria
=
new
Criteria
(
)
;
$criteria
->
setLimit
(
1
)
;
$client
=
$this
->
createMock
(
Client::
class
)
;
// client should not be used if limit is 0
$client
->
expects
(
static
::
once
(
)
)
->
method
(
'search'
)
->
willThrowException
(
new
NoNodesAvailableException
(
)
)
;
$helper
=
$this
->
createMock
(
ElasticsearchHelper::
class
)
;
$helper
->
expects
(
static
::
once
(
)
)
->
method
(
'logAndThrowException'
)
;
$helper
->
method
(
'allowSearch'
)
->
willReturn
(
true
)
;
$searcher
=
new
ElasticsearchEntitySearcher
(
$client
,
$this
->
createMock
(
EntitySearcherInterface::
class
)
,
$helper
,
new
CriteriaParser
(
new
EntityDefinitionQueryHelper
(
)
,
$this
->
createMock
(
CustomFieldService::
class
)
,
$this
->
createMock
(
AbstractKeyValueStorage::
class
)
)
,
$this
->
createMock
(
AbstractElasticsearchSearchHydrator::
class
)
,