schmittsfn
schmittsfn

Reputation: 1442

OCMock: Mock objects that implement several protocols?

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?

Upvotes: 3

Views: 890

Answers (2)

user477243
user477243

Reputation:

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));

Upvotes: 6

Erik Doernenburg
Erik Doernenburg

Reputation: 3015

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).

Upvotes: 1

Related Questions