ocmock icon indicating copy to clipboard operation
ocmock copied to clipboard

Mock objects that implement several protocols

Open schmittsfn opened this issue 10 years ago • 2 comments

First of all OCMock is a great tool, thank you for all the hard work on it!

OCMock doesn't provide a way to create a mock object that implements several protocols. I believe that this would be a useful addition.

What do you think?

schmittsfn avatar Feb 16 '15 11:02 schmittsfn

Agreed. Now I need to find the time to implement it...

erikdoe avatar Feb 16 '15 11:02 erikdoe

For the time being you can use this workaround: in your test file, you can create a new protocol that implements the multiple ones you need:

@protocol MyTestProtocol <MyProtocolA, MyProtocolB>
@end

and then mock it:

id protocolMock = OCMProtocolMock(@protocol(MyTestProtocol));

tinsukE avatar Jun 10 '15 13:06 tinsukE