Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
MessengerDataCollector example
public
function
testHandle
(
)
{
$message
=
new
DummyMessage
(
'dummy message'
)
;
$envelope
=
new
Envelope
(
$message
)
;
$bus
=
$this
->
createMock
(
MessageBusInterface::
class
)
;
$bus
->
method
(
'dispatch'
)
->
with
(
$message
)
->
willReturn
(
$envelope
)
;
$bus
=
new
TraceableMessageBus
(
$bus
)
;
$collector
=
new
MessengerDataCollector
(
)
;
$collector
->
registerBus
(
'default',
$bus
)
;
$bus
->
dispatch
(
$message
)
;
$collector
->
lateCollect
(
)
;
$messages
=
$collector
->
getMessages
(
)
;
$this
->
assertCount
(
1,
$messages
)
;
$file
= __FILE__;
$expected
= <<<DUMP