The method class_conformsToProtocol doesn't take superclasses into account, so the correct implementation of conformsToProtocol in OCClassMockObject would be along the following lines:
- (BOOL)conformsToProtocol:(Protocol *)aProtocol
{
Class clazz = mockedClass;
while (clazz != nil) {
if (class_conformsToProtocol(clazz, aProtocol)) {
return YES;
}
clazz = class_getSuperclass(clazz);
}
return NO;
}
The method class_conformsToProtocol doesn't take superclasses into account, so the correct implementation of conformsToProtocol in OCClassMockObject would be along the following lines: