Skip to content

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