/** @var AbstractIncrementer $pool */
$pool =
$this->
getContainer() ->
get('shopware.increment.gateway.registry'
) ->
get(IncrementGatewayRegistry::MESSAGE_QUEUE_POOL
);
$pool->
reset('message_queue_stats'
);
/** @var MessageBusInterface $bus */
$bus =
$this->
getContainer()->
get('messenger.bus.test_shopware'
);
$bus->
dispatch(new FooMessage());
$bus->
dispatch(new BarMessage());
$bus->
dispatch(new BarMessage());
$bus->
dispatch(new BarMessage());
$stats =
$pool->
list('message_queue_stats'
);
static::
assertEquals(1,
$stats[FooMessage::
class]['count'
]);
static::
assertEquals(3,
$stats[BarMessage::
class]['count'
]);
$this->
runWorker();
$stats =
$pool->
list('message_queue_stats'
);
static::
assertEquals(0,
$stats[FooMessage::
class]['count'
]);