Skip to content
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

Bus assertempty #53664

Merged
merged 2 commits into from
Nov 25, 2024
Merged

Bus assertempty #53664

merged 2 commits into from
Nov 25, 2024

Conversation

jasonmccreary
Copy link
Contributor

Similar to the MailFake, this adds a unified assertion to test nothing was placed on the bus - either dispatched, chained, or batched.

Before

Bus::fake()

// ...

Bus::assertNothingDispatched();
Bus::assertNothingBatched();

After

Bus::fake()

// ...

Bus::assertNothingPlaced();

This also adds assertNothingChained which is simply an alias for assertNothingDispatched. However, it provides some symmetry with the other assertions and lowers to barrier to entry. Otherwise the developer needs to know that a job chain immediately dispatches the first job and therefore they can use assertNothingDispatched.

@jasonmccreary
Copy link
Contributor Author

@taylorotwell, please feel free to wordsmith the name. Since assertNothingDispatched was already taken and does something else, I was having trouble thinking of other words in the Bus vocabulary to rely the method intent.

@taylorotwell taylorotwell merged commit e94a5cb into laravel:11.x Nov 25, 2024
40 checks passed
@jasonmccreary jasonmccreary deleted the bus-assertempty branch November 25, 2024 22:54
taylorotwell pushed a commit that referenced this pull request Nov 26, 2024
* Correct test names

* Strengthen test to enforce alias

* Modernize code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants