-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Messenger] Add options to FailedMessagesShowCommand
#39330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
761ae5d
Add group and class-filter options to FailedMessagesShowCommand
2a43756
Update changelog
c6cdb8f
review
fd946b1
Review + fix post-rebase
fguimier 40d7bcf
Fix build
fguimier 08676a9
Add more output in case of class-filter usage
fguimier a2ffddb
Update src/Symfony/Component/Messenger/CHANGELOG.md
fguimier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,7 +117,7 @@ public function testBasicRunWithServiceLocator() | |
Error Things are bad! | ||
Error Code 123 | ||
Error Class Exception | ||
Transport async | ||
Transport async | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The extra spaces should be removed |
||
EOF | ||
, | ||
$redeliveryStamp->getRedeliveredAt()->format('Y-m-d H:i:s')), | ||
|
@@ -198,7 +198,7 @@ public function testMultipleRedeliveryFailsWithServiceLocator() | |
Error Things are bad! | ||
Error Code 123 | ||
Error Class Exception | ||
Transport async | ||
Transport async | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The extra spaces should be removed |
||
EOF | ||
, | ||
$redeliveryStamp2->getRedeliveredAt()->format('Y-m-d H:i:s')), | ||
|
@@ -443,6 +443,62 @@ public function testListMessagesReturnsPaginatedMessagesWithServiceLocator() | |
$this->assertStringContainsString('Showing first 1 messages.', $tester->getDisplay(true)); | ||
} | ||
|
||
public function testListMessagesReturnsFilteredByClassMessage() | ||
{ | ||
$sentToFailureStamp = new SentToFailureTransportStamp('async'); | ||
$envelope = new Envelope(new \stdClass(), [ | ||
new TransportMessageIdStamp(15), | ||
$sentToFailureStamp, | ||
new RedeliveryStamp(0), | ||
ErrorDetailsStamp::create(new \RuntimeException('Things are bad!')), | ||
]); | ||
$receiver = $this->createMock(ListableReceiverInterface::class); | ||
$receiver->method('all')->with()->willReturn([$envelope]); | ||
|
||
$failureTransportName = 'failure_receiver'; | ||
$serviceLocator = $this->createMock(ServiceLocator::class); | ||
$serviceLocator->method('has')->with($failureTransportName)->willReturn(true); | ||
$serviceLocator->method('get')->with($failureTransportName)->willReturn($receiver); | ||
|
||
$command = new FailedMessagesShowCommand('failure_receiver', $serviceLocator); | ||
|
||
$tester = new CommandTester($command); | ||
$tester->execute([]); | ||
$this->assertStringContainsString('Things are bad!', $tester->getDisplay(true)); | ||
$tester->execute(['--class-filter' => 'stdClass']); | ||
$this->assertStringContainsString('Things are bad!', $tester->getDisplay(true)); | ||
$this->assertStringContainsString('Showing 1 message(s).', $tester->getDisplay(true)); | ||
$this->assertStringContainsString('Displaying only \'stdClass\' messages', $tester->getDisplay(true)); | ||
|
||
$tester->execute(['--class-filter' => 'namespace\otherClass']); | ||
$this->assertStringContainsString('[OK] No failed messages were found.', $tester->getDisplay(true)); | ||
$this->assertStringContainsString('Displaying only \'namespace\otherClass\' messages', $tester->getDisplay(true)); | ||
} | ||
|
||
public function testListMessagesReturnsCountByClassName() | ||
{ | ||
$sentToFailureStamp = new SentToFailureTransportStamp('async'); | ||
$envelope = new Envelope(new \stdClass(), [ | ||
new TransportMessageIdStamp(15), | ||
$sentToFailureStamp, | ||
new RedeliveryStamp(0), | ||
ErrorDetailsStamp::create(new \RuntimeException('Things are bad!')), | ||
]); | ||
$receiver = $this->createMock(ListableReceiverInterface::class); | ||
$receiver->method('all')->with()->willReturn([$envelope, $envelope]); | ||
|
||
$failureTransportName = 'failure_receiver'; | ||
$serviceLocator = $this->createMock(ServiceLocator::class); | ||
$serviceLocator->method('has')->with($failureTransportName)->willReturn(true); | ||
$serviceLocator->method('get')->with($failureTransportName)->willReturn($receiver); | ||
|
||
$command = new FailedMessagesShowCommand('failure_receiver', $serviceLocator); | ||
|
||
$tester = new CommandTester($command); | ||
$tester->execute(['--stats' => 1]); | ||
$this->assertStringContainsString('stdClass 2', $tester->getDisplay(true)); | ||
} | ||
|
||
/** | ||
* @group legacy | ||
*/ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.