public function testItRetrieveTheFirstAvailableMessage() { $this->connection->
setup();
// insert messages
// one currently handled
$this->driverConnection->
insert('messenger_messages',
[ 'body' => '{"message": "Hi handled"}',
'headers' =>
json_encode(['type' => DummyMessage::
class]),
'queue_name' => 'default',
'created_at' =>
$this->
formatDateTime(new \
DateTimeImmutable('2019-03-15 12:00:00',
new \
DateTimeZone('UTC'
))),
'available_at' =>
$this->
formatDateTime(new \
DateTimeImmutable('2019-03-15 12:00:00',
new \
DateTimeZone('UTC'
))),
'delivered_at' =>
$this->
formatDateTime(new \
DateTimeImmutable('now',
new \
DateTimeZone('UTC'
))),
]);
// one available later
$this->driverConnection->
insert('messenger_messages',
[ 'body' => '{"message": "Hi delayed"}',
'headers' =>
json_encode(['type' => DummyMessage::
class]),
'queue_name' => 'default',
'created_at' =>
$this->
formatDateTime(new \
DateTimeImmutable('2019-03-15 12:00:00',
new \
DateTimeZone('UTC'
))),
'available_at' =>
$this->
formatDateTime(new \
DateTimeImmutable('2019-03-15 13:00:00',
new \
DateTimeZone('UTC'
))),
]);