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

[5.7] Fix #22951 permanently: Using shouldIgnoreMissing on dispatcher mock #26437

Merged
merged 1 commit into from
Nov 8, 2018

Conversation

Jnesselr
Copy link
Contributor

@Jnesselr Jnesselr commented Nov 8, 2018

#22951 was "fixed" by adding methods to the dispatcher contract, which is great, but Mockery will still fail if you haven't set up expectations for the methods that get called.

In my particular case, the getCommandHandler method was being called but it hadn't been defined. So I see 2 potential resolutions to this issue:

  1. Define the mock method I'm having issues with to something that makes sense.
  2. Add shouldIgnoreMissing to the mock definition which has the benefit of not having the particular error happen again but could potentially be bad if you want it to fail if a mocked method isn't defined.

Since the dispatch and dispatchNow command are mocked, the command handler isn't really used and is fine with being set to null (as best as I can tell) so I went with option 2. I also don't think the con is super bad either with that method.

@Jnesselr Jnesselr changed the title Fix #22951 permanently: Using shouldIgnoreMissing on dispatcher mock [5.7] Fix #22951 permanently: Using shouldIgnoreMissing on dispatcher mock Nov 8, 2018
@taylorotwell taylorotwell merged commit 892b2ce into laravel:5.7 Nov 8, 2018
taisph pushed a commit to cubs/laravel-framework that referenced this pull request May 25, 2020
taisph pushed a commit to cubs/laravel-framework that referenced this pull request Apr 28, 2021
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