Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[FrameworkBundle] PhpUnit assert Messenger#51964

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
marilenaRM wants to merge2 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
frommarilenaRM:feature/Add-Messenger-Assertion-Trait

Conversation

marilenaRM
Copy link

@marilenaRMmarilenaRM commentedOct 10, 2023
edited by OskarStark
Loading

QA
Branch?6.4
Bug fix?no
New feature?yes
Deprecations?no
Tickets
LicenseMIT

Hello,
This MessengerAssertionTrait is a Helper for those who want to be able to test the dispatched messages while working with Messenger.

$this->assertMessagesByBusCount(6);//no busName = total count$this->assertMessagesByBusCount(2,'event.bus');$this->assertMessagesByBusCount(4,'query.bus');$this->assertMessagesOfClassCount(2, DummyCommand::class);$this->assertMessagesOfClassCount(3, DummyQuery::class);$this->assertMessagesOfClassCount(1, DummyMessage::class);/** @var DummyMessage[] $dummyMessages */$dummyMessages =$this::getDispatchedMessagesByClassName(DummyMessage::class);self::assertCount(1,$dummyMessages);self::assertStringContainsString('dummy message text',$dummyMessages[0]->getMessage());$messagesFromQueryBus =$this::getDispatchedMessagesByBusName('query.bus');self::assertCount(4,$messagesFromQueryBus);self::assertInstanceOf(DummyMessage::class,$messagesFromQueryBus[0]);/** @var DummyQuery $firstQuery */self::assertInstanceOf(DummyQuery::class,$firstQuery =$messagesFromQueryBus[1]);self::assertStringContainsString('First Dummy Query message',$firstQuery->getMessage());

Hope this helps!
Regards,
Marilena Ruffelaere

Jean-Beru and mariecharles reacted with hooray emoji
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

marilenaRM reacted with thumbs up emoji

@marilenaRMmarilenaRMforce-pushed thefeature/Add-Messenger-Assertion-Trait branch from4fa419f to35def9dCompareOctober 10, 2023 09:29
@stof
Copy link
Member

Labelling the PR as PhpUnitBridge is wrong as this adds the feature in FrameworkBundle.

marilenaRM reacted with thumbs up emoji

@marilenaRMmarilenaRM changed the title[PhpUnitBridge] PhpUnit assert Messenger[FrameworkBundle] PhpUnit assert MessengerOct 10, 2023
@marilenaRMmarilenaRMforce-pushed thefeature/Add-Messenger-Assertion-Trait branch 2 times, most recently from34956ed tofbaeb1cCompareOctober 10, 2023 09:46
@marilenaRMmarilenaRMforce-pushed thefeature/Add-Messenger-Assertion-Trait branch fromfbaeb1c to324586cCompareOctober 10, 2023 09:49
@marilenaRMmarilenaRMforce-pushed thefeature/Add-Messenger-Assertion-Trait branch 3 times, most recently from09e6f34 to0398f6eCompareOctober 12, 2023 09:10
* @param string|null $busName The busName to consider
* @param string|null $messageFQCN The message object class name to consider
*/
public static function assertMessagesCount(int $count, string $busName = null, string $messageFQCN = null, string $message = ''): void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Very small suggestion : I thinkassetMessageCount (without the 's') would be more 'correct' 😃

@marilenaRMmarilenaRMforce-pushed thefeature/Add-Messenger-Assertion-Trait branch from0398f6e toa96e01cCompareOctober 23, 2023 10:28
@marilenaRMmarilenaRMforce-pushed thefeature/Add-Messenger-Assertion-Trait branch froma96e01c to2ed780cCompareOctober 23, 2023 11:45
@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.1Nov 15, 2023
@xabbuhxabbuh modified the milestones:7.1,7.2May 15, 2024
@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@fabpotfabpot removed this from the7.3 milestoneMay 26, 2025
@fabpotfabpot added this to the7.4 milestoneMay 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Jean-BeruJean-BeruJean-Beru left review comments

@maelanleborgnemaelanleborgnemaelanleborgne left review comments

@ktheragektheragektherage left review comments

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

9 participants
@marilenaRM@carsonbot@stof@Jean-Beru@maelanleborgne@ktherage@fabpot@nicolas-grekas@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp