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

[10.x] Fix BusFake::assertChained() for a single job #47832

Conversation

gehrisandro
Copy link
Contributor

There is a bug when using the Bus::assertChained() method with an array containing only a single job.

It always returns an assertion error: The expected chain can not be empty.

Providing two or more jobs works fine.

This PR resolves this issue by removing a check if the $expectedChain is empty, which is the case, if only one job is provided as the first one gets removed from the $expectedChain on line 323.

Another solution would be to move the check upwards before the array_slice(). But because there was no failing test when removing the check, I decided to remove it entirely.

If you prefer to keep the check please let me know. I will adjust the PR and add the missing test for that.

@taylorotwell taylorotwell merged commit 0965fc1 into laravel:10.x Jul 25, 2023
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.

2 participants