Replies: 1 comment 1 reply
-
Did you try documentation way ?
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to mock a class that is created using a static method
This is how I bind it to the container:
This is how I use the class
I cannot store the
$data
globally to get rid of the parameter in my binding.The problem is that when I try to mock or spy on
MyClass
it does not work.If I dump
app(MyClass::class)
the mocked class is returned. But when I dumpapp(MyClass::class, [$data])
the original class is returned, not the mocked one.How can I successfully mock my class? Is there a better way to do this (ex. refactor the class)?
Beta Was this translation helpful? Give feedback.
All reactions