mockery icon indicating copy to clipboard operation
mockery copied to clipboard

Convenient methods for faking Array interfaces

Open courtney-miles opened this issue 7 years ago • 1 comments

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

courtney-miles avatar Aug 25 '18 02:08 courtney-miles

Open the PR and we'll take a look :+1:

At worst, there'll be a working example for others to look at.

davedevelopment avatar Sep 05 '18 13:09 davedevelopment