mockery
mockery copied to clipboard
Convenient methods for faking Array interfaces
I have a trait I copy across my various projects to make it easy to mock objects that implement the various array interfaces.
It's pretty simple. You supply it the name of the class to mock, and the array values for it to return for whichever array-like interfaces it may implement.
The only catch is that you can't set expectations.
I use this a lot test code that works with \Symfony\Component\Validator\ConstraintViolationListInterface.
Would the maintainers be interested in a PR to include this functionality with Mockery?
This would be inline with the discussion in #63
Open the PR and we'll take a look :+1:
At worst, there'll be a working example for others to look at.