Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
FailedMessagesRemoveCommand example
class
FailedMessagesRemoveCommandTest
extends
TestCase
{
public
function
testRemoveSingleMessageWithServiceLocator
(
)
{
$globalFailureReceiverName
= 'failure_receiver';
$receiver
=
$this
->
createMock
(
ListableReceiverInterface::
class
)
;
$receiver
->
expects
(
$this
->
once
(
)
)
->
method
(
'find'
)
->
with
(
20
)
->
willReturn
(
new
Envelope
(
new
\
stdClass
(
)
)
)
;
$serviceLocator
=
$this
->
createMock
(
ServiceLocator::
class
)
;
$serviceLocator
->
expects
(
$this
->
once
(
)
)
->
method
(
'has'
)
->
with
(
$globalFailureReceiverName
)
->
willReturn
(
true
)
;
$serviceLocator
->
expects
(
$this
->
any
(
)
)
->
method
(
'get'
)
->
with
(
$globalFailureReceiverName
)
->
willReturn
(
$receiver
)
;
$command
=
new
FailedMessagesRemoveCommand
(
$globalFailureReceiverName
,
$serviceLocator
)
;
$tester
=
new
CommandTester
(
$command
)
;
$tester
->
execute
(
[
'id' => 20, '--force' => true
]
)
;
$this
->
assertStringContainsString
(
'Failed Message Details',
$tester
->
getDisplay
(
)
)
;
$this
->
assertStringContainsString
(
'Message with id 20 removed.',
$tester
->
getDisplay
(
)
)
;
}