Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getRejectCount example
$bus
=
$this
->
createMock
(
MessageBusInterface::
class
)
;
$bus
->
method
(
'dispatch'
)
->
willThrowException
(
new
\
InvalidArgumentException
(
'Why not'
)
)
;
$dispatcher
=
new
EventDispatcher
(
)
;
$dispatcher
->
addSubscriber
(
new
StopWorkerOnMessageLimitListener
(
1
)
)
;
$worker
=
new
Worker
(
[
'transport1' =>
$receiver
]
,
$bus
,
$dispatcher
, clock:
new
MockClock
(
)
)
;
$worker
->
run
(
)
;
$this
->
assertSame
(
1,
$receiver
->
getRejectCount
(
)
)
;
$this
->
assertSame
(
0,
$receiver
->
getAcknowledgeCount
(
)
)
;
}
public
function
testWorkerResetsConnectionIfReceiverIsResettable
(
)
{
$resettableReceiver
=
new
ResettableDummyReceiver
(
[
]
)
;
$dispatcher
=
new
EventDispatcher
(
)
;
$dispatcher
->
addSubscriber
(
new
ResetServicesListener
(
new
ServicesResetter
(
new
\
ArrayIterator
(
[
$resettableReceiver
]
)
,
[
'reset'
]
)
)
)
;
$bus
=
$this
->
createMock
(
MessageBusInterface::
class
)
;