How to mock interface static method (+)?

Discussion of the OCMock framework. If you have patches we would prefer you to send them to the mailing list, but attaching them to a topic is possible, too.

How to mock interface static method (+)?

Postby jianhuayu » 08 Dec 2011, 08:18

Need to write unit testing for the following code, I want to do mock for instance static method canMakePayments, return yes or no, so far no good method found dues to canMakePayments is a static method (+), seems all OCMock methods are all used for object method (-).

You guys any suggestion or discussion will be appreciated. Thanks.

// SKPaymentQueue.h
// StoreKit
if ([SKPaymentQueue canMakePayments]){
....
}
else{
...
}
jianhuayu
 
Posts: 1
Joined: 27 Nov 2011, 14:45

Re: How to mock interface static method (+)?

Postby Paul Stringer » 06 Jan 2012, 17:12

Try this

http://twobitlabs.com/2011/02/mocking-singletons-with-ocmock/
Paul Stringer
 


Return to OCMock