[Messenger] Fix messenger:failed:remove can not remove single message
This commit is contained in:
parent
c30d6f9e38
commit
e66cd97ec3
@ -61,7 +61,7 @@ EOF
|
||||
$receiver = $this->getReceiver();
|
||||
|
||||
$shouldForce = $input->getOption('force');
|
||||
$ids = $input->getArgument('id');
|
||||
$ids = (array) $input->getArgument('id');
|
||||
$shouldDisplayMessages = $input->getOption('show-messages') || 1 === \count($ids);
|
||||
$this->removeMessages($ids, $receiver, $io, $shouldForce, $shouldDisplayMessages);
|
||||
|
||||
|
@ -19,6 +19,23 @@ use Symfony\Component\Messenger\Transport\Receiver\ListableReceiverInterface;
|
||||
|
||||
class FailedMessagesRemoveCommandTest extends TestCase
|
||||
{
|
||||
public function testRemoveSingleMessage()
|
||||
{
|
||||
$receiver = $this->createMock(ListableReceiverInterface::class);
|
||||
$receiver->expects($this->once())->method('find')->with(20)->willReturn(new Envelope(new \stdClass()));
|
||||
|
||||
$command = new FailedMessagesRemoveCommand(
|
||||
'failure_receiver',
|
||||
$receiver
|
||||
);
|
||||
|
||||
$tester = new CommandTester($command);
|
||||
$tester->execute(['id' => 20, '--force' => true]);
|
||||
|
||||
$this->assertStringContainsString('Failed Message Details', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Message with id 20 removed.', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testRemoveUniqueMessage()
|
||||
{
|
||||
$receiver = $this->createMock(ListableReceiverInterface::class);
|
||||
|
Reference in New Issue
Block a user