3
id protocolMock = OCMProtocolMock(@protocol(SomeProtocol));

Will create a mock object that can be used as if it were an instance of an object that implements SomeProtocol.

Does OCMock provide a way to create a mock object that implements several protocols?

schmittsfn
  • 1,412
  • 18
  • 40

2 Answers2

6

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
  • 930
  • 9
  • 20
0

This is currently not supported in OCMock. If you think this is a feature that really should be added, please log an issue on Github (https://github.com/erikdoe/ocmock/issues).

Erik Doernenburg
  • 2,933
  • 18
  • 21