$response =
json_decode((string) $client->
getResponse()->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);
static::
assertSame(200,
$client->
getResponse()->
getStatusCode(), \
print_r($response, true
));
static::
assertArrayHasKey('handledMessages',
$response);
static::
assertIsInt($response['handledMessages'
]);
static::
assertEquals(1,
$response['handledMessages'
]);
} public function testMessageStatsDecrement(): void
{ $messageBus =
$this->
getContainer()->
get('messenger.bus.shopware'
);
$message =
new ProductIndexingMessage([Uuid::
randomHex()]);
$messageBus->
dispatch($message);
$gateway =
$this->
getContainer()->
get('shopware.increment.gateway.registry'
);
$entries =
$gateway->
get(IncrementGatewayRegistry::MESSAGE_QUEUE_POOL
)->
list('message_queue_stats'
);
static::
assertArrayHasKey(ProductIndexingMessage::
class,
$entries);
static::
assertGreaterThan(0,
$entries[ProductIndexingMessage::
class]['count'
]);
$url = '/api/_action/message-queue/consume';
$client =
$this->
getBrowser();
$client->
request('POST',
$url,
['receiver' => 'async'
]);