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
Add withArgs()
to validate via closure passed arguments at once
#459
Comments
With proposed Instead I recommend using |
Thanks @aik099 for your response. To use The only aim of my proposal is to have less verbose test code, so... Well, yes, I assume that Thats IMO should not be a problem: for example, currently you can't mix |
@padraic @aik099 @Giuseppe-Mazzapica So, what do you think about this feature? Should it be added to the API? Can I start working on it? |
Can for me! |
How we can distinguish between 2 cases:
? |
Ah, the |
Yeah, |
ok, I'll try it :) |
…functionality to support a closure as only argument to validate all passed arguments at once.
…passed to the closure
In my opinion, withArgs($argsOr$cloure) should be separated as withArgs(array $args) and withArgsUsing(Closure $closure), and it could solve the problom. BTW: The document has been updated but not the code, so it's a BUG now. |
Yeah, just came here to say the same. The documentation for 0.9 regarding |
I'm not sure I understand, didn't this get merged in to the master branch? If someone could point me directly to the differences, I'll take a look. |
The documentation, whose title says "Mockery Docs 0.9 documentation" contains this:
However that is not true for Mockery 0.9, where It is also not true for the master branch, where |
@Revisor Thanks! I think there are a few problems in play here, will try and get them sorted. |
Fixed the documentation title in 0f183fa So now the stable docs have "Mockery docs 0.9" in the title, the latest have "Mockery docs 1.0-alpha". The documentation for the |
Thank you. May I suggest, instead of
Format it like this
What do you think? |
Sure, done in 89f7708 |
That's more a question for davedevelopment, but as far as I can see, there is currently no tagged version supporting closure as an argument for But maybe Dave could tag the current version as 1.0 alpha? |
Thanks @Revisor, well surfing dangerously it is then |
@davedevelopment @Revisor @halfer |
@rparsi-commer: the latest release 0.9.9 does not have the closure facility, so that still requires It would be nice to see a release tag including this, but if you are stuck and don't want to build against HEAD for stability reasons, fork the code and create your own tag/branch. You can point your |
@halfer So closures don't work at all? No matter what I do my closure doesn't get called. I'm mocking a method that has signature ($stringValue, BlahInterface $blah) where How do I do this with current stable release? |
No @rparsi-commer, they work just fine. We're probably talking at cross-purposes; my point was that there is not a release for this, so you have to build against the master of Mockery. Here is the line in my
You don't, it is not in a stable release. As I have explained, if you don't want to point at a moving target, fork the code yourself and point at that. |
@halfer Ok, thanks for the clarification. |
There is a 1.0.0-alpha1 tag, I'd recommend moving to that. I find it stable enough for my tests. |
Lovely, will do @davedevelopment. |
If I'm understanding this thread correctly, the feature requested is implemented, and available since 1.0.0-alpha1 tag, so I'm going to close this issue. Please open a new issue if there's still something amiss with this. |
I think would be handy a method like
withArgs($closure)
that would work similar to
with the only difference that in first case the
$closure
receives all the arguments passed to the target method.The text was updated successfully, but these errors were encountered: