-
Notifications
You must be signed in to change notification settings - Fork 456
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
RFC: Callable spies #712
RFC: Callable spies #712
Conversation
Also probably worth considering if it's even worth putting this in to mockery. It's simple enough to maintain I think, but the functionality isn't too difficult to roll on your own as you don't really need the code generation etc. |
library/Mockery.php
Outdated
@@ -92,6 +93,12 @@ public static function mock(...$args) | |||
*/ | |||
public static function spy(...$args) | |||
{ | |||
$args = func_get_args(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should not be necessary. ...$args is an array of all function arguments already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@davedevelopment what's the status with this? Does it require any more work? |
@robertbasic no further progress. Error messages are not very friendly at the moment. Happy to merge as an experimental feature. |
sorry, I somehow missed this MR. In the mean time I found a problem we would have with this implementation in laravel: they have a lot of functions where they only allow So for me this is good |
Merged, will leave undocumented as it's still considered experimental |
Here's a take on the request in #711
Todos/considerations
ClosureWrapper::__invoke
etcexpects
andallows
somehow. Might get too complicated.shouldNotHaveBeenCalledWith(123, 456, 789)
? I think I prefer this for specifying arguments with anot