$process->
start();
$this->
waitForOutput($process,
$expectedOutput = "Receiving messages...\n"
);
$signalTime =
microtime(true
);
$timedOutTime =
time() + 10;
// wait for worker started and registered the signal handler
usleep(100 * 1000
); // 100ms
// immediately after the process has started "booted", kill it
$process->
signal(15
);
while ($process->
isRunning() &&
time() <
$timedOutTime) { usleep(100 * 1000
); // 100ms
} // make sure the process exited, after consuming only the 1 message
$this->
assertFalse($process->
isRunning());
$this->
assertLessThan($amqpReadTimeout,
microtime(true
) -
$signalTime);
$this->
assertSame($expectedOutput.<<<'TXT'
Get envelope with message: Symfony\Component\Messenger\Bridge\Amqp\Tests\Fixtures\DummyMessage
with stamps: [
"Symfony\\Component\\Messenger\\Stamp\\SerializedMessageStamp",
"Symfony\\Component\\Messenger\\Bridge\\Amqp\\Transport\\AmqpReceivedStamp",
"Symfony\\Component\\Messenger\\Stamp\\ReceivedStamp",
"Symfony\\Component\\Messenger\\Stamp\\ConsumedByWorkerStamp",
"Symfony\\Component\\Messenger\\Stamp\\AckStamp"
]
Done.