-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Unable to make spy of the "Schema" facade #37983
Comments
Why do you need to spy on the |
I was trying to write a test for something that was calling the |
It's unclear at the moment if this is solvable on our side due to how our the schema stuff is setup. My best suggestion is to put your Schema operations you want to test behind another class like |
Going to close this one now. @awjudd there doesn't seems to be an easy way for us to fix this so please try the suggestions by Taylor. |
I sent in a possible solution for this here: #38017 Btw @awjudd, while investigating I noticed you have a slight issue in your code. It should be |
Good catch - about the |
Description:
When testing and trying set up the spy on the
Schema
object (i.e.Schema::spy()
), you receive an exception.Steps To Reproduce:
1 - Create a test case
2 - Call the following:
3 - When you run the test case, you will receive the following error:
Commit with the issue:
https://github.com/awjudd/laravel-schema-issue/commit/9040182ce26fc4572c6c79f6200d13d12ddc8042
Extra Information
When digging a little deeper, it looks like there are at least 2 spots that have the same issue. In
src/Illuminate/Support/Facades/Schema.php
the following methods:swap
isMock
I believe that it has to do with the following change:
63d87d7
The reason being, at this point in time the method no longer could be trusted to only return a string, so doing the dictionary lookup was ignored in one spot (63d87d7#diff-85c2ee3096a7c4457f3abe3785b2584af93e1672402207cee10195543acbba49R167)
The text was updated successfully, but these errors were encountered: