Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ElasticsearchAdminResetCommand example
protected
function
setUp
(
)
: void
{
$this
->connection =
$this
->
createMock
(
Connection::
class
)
;
$this
->client =
$this
->
createMock
(
Client::
class
)
;
}
public
function
testExecuteWithEsNotEnabled
(
)
: void
{
$searchHelper
=
$this
->
getMockBuilder
(
AdminElasticsearchHelper::
class
)
->
disableOriginalConstructor
(
)
->
getMock
(
)
;
$searchHelper
->
expects
(
static
::
any
(
)
)
->
method
(
'getEnabled'
)
->
willReturn
(
false
)
;
$commandTester
=
new
CommandTester
(
new
ElasticsearchAdminResetCommand
(
$this
->client,
$this
->connection,
$this
->
createMock
(
IncrementGatewayRegistry::
class
)
,
$searchHelper
)
)
;
$commandTester
->
execute
(
[
]
)
;
$message
=
$commandTester
->
getDisplay
(
)
;
static
::
assertStringContainsString
(
'Admin elasticsearch is not enabled',
$message
)
;
}