Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 87a5701

Browse filesBrowse files
committed
bug #36660 [Messenger] Fix messenger:failed:remove can not remove single message (tienvx)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Messenger] Fix messenger:failed:remove can not remove single message | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #36659 | License | MIT | Doc PR | - Fix this error: ``` count(): Parameter must be an array or an object that implements Countable ``` When calling `messenger:failed:remove` command from other code with single id Commits ------- e66cd97 [Messenger] Fix messenger:failed:remove can not remove single message
2 parents eebb3ef + e66cd97 commit 87a5701
Copy full SHA for 87a5701

File tree

2 files changed

+18
-1
lines changed
Filter options

2 files changed

+18
-1
lines changed

‎src/Symfony/Component/Messenger/Command/FailedMessagesRemoveCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Command/FailedMessagesRemoveCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6161
$receiver = $this->getReceiver();
6262

6363
$shouldForce = $input->getOption('force');
64-
$ids = $input->getArgument('id');
64+
$ids = (array) $input->getArgument('id');
6565
$shouldDisplayMessages = $input->getOption('show-messages') || 1 === \count($ids);
6666
$this->removeMessages($ids, $receiver, $io, $shouldForce, $shouldDisplayMessages);
6767

‎src/Symfony/Component/Messenger/Tests/Command/FailedMessagesRemoveCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Tests/Command/FailedMessagesRemoveCommandTest.php
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,23 @@
1919

2020
class FailedMessagesRemoveCommandTest extends TestCase
2121
{
22+
public function testRemoveSingleMessage()
23+
{
24+
$receiver = $this->createMock(ListableReceiverInterface::class);
25+
$receiver->expects($this->once())->method('find')->with(20)->willReturn(new Envelope(new \stdClass()));
26+
27+
$command = new FailedMessagesRemoveCommand(
28+
'failure_receiver',
29+
$receiver
30+
);
31+
32+
$tester = new CommandTester($command);
33+
$tester->execute(['id' => 20, '--force' => true]);
34+
35+
$this->assertStringContainsString('Failed Message Details', $tester->getDisplay());
36+
$this->assertStringContainsString('Message with id 20 removed.', $tester->getDisplay());
37+
}
38+
2239
public function testRemoveUniqueMessage()
2340
{
2441
$receiver = $this->createMock(ListableReceiverInterface::class);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.