public function testRun(): void
{ // Add a second storefront sales channel, to check if all sales channels will be recognized for the product export
$this->
createSecondStorefrontSalesChannel();
$this->
createProductStream();
// only get seconds, not microseconds, for better comparison to DB
/** @var \DateTime $previousGeneratedAt */
$previousGeneratedAt = \DateTime::
createFromFormat('U',
(string) time());
$exportId =
$this->
createTestEntity($previousGeneratedAt);
$this->
clearQueue();
$this->
getTaskHandler()->
run();
$url = '/api/_action/message-queue/consume';
$client =
$this->
getBrowser();
$client->
request('POST',
$url,
['receiver' => 'async'
]);
static::
assertSame(200,
$client->
getResponse()->
getStatusCode());
$response =
json_decode((string) $client->
getResponse()->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);
static::
assertArrayHasKey('handledMessages',
$response);
static::
assertIsInt($response['handledMessages'
]);