Mockery pass constructor arguments - is this a bug/feature-request? #49858
Unanswered
mastacheata
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Mockery is a third-party package. Have you asked your question there as well? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Also: Just discovered that the callback behaves completely different to what I had expected from the documentation. The binding of the Mocked Class to the container happens outside of the Closure. Within the Closure it's not bound. I guess that's why the only test for the mock helpers doesn't even use the syntax as shown in the Laravel docs. 😱 |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Hey there,
the built-in helper-method from Laravel expects a Closure and only a Closure as a second parameter after the FQCN to be mocked.
There's 2 things that bother me about this:
Mockery::mock
is an undocumented Feature of MockeryMockery::mock
is an array of arguments to pass to the mocked class' constructor. The Laravel helper removes this feature in favor of the scoped-closure by way of specifying the argument types, but the implementation is perfectly set up to pass along arbitrary parameters to Mockery.Was this intended to both shadow and change the behavior of the original call or is this maybe some legacy feature of Mockery that's now been superceded?
I would really love to have the documented behavior of passing the constructor arguments along without having to go the full manual route.
Beta Was this translation helpful? Give feedback.
All reactions