Comments (4)
I'm not aware of any issues. Are you saying everything compiles cleanly, the test gets invoked, the calls above do not throw any exceptions and still the cacheFolder message doesn't get stubbed? That would be really odd.
from ocmock.
Ok, I've created example project to visualise this problem. Please clone this repo: https://github.com/badeleux/OCMockPodTest
My output for test method:
2014-02-14 08:27:01.406 OCMockPodTest[2820:70b] TEST STUB: /Volumes/test5M /Volumes/test5M
2014-02-14 08:27:11.008 OCMockPodTest[2820:70b] TEST STUB: /Volumes/test5M ~/Library/Application Support/iPhone Simulator/7.0.3/Applications/7E89CD46-D81B-45E0-96CA-B89C8F1B0383/tmp/Incomplete
2014-02-14 08:27:21.919 OCMockPodTest[2820:70b] TEST STUB: /Volumes/test5M /Volumes/test5M
This demo presents my problem. Stubbing mechanism works for ViewController which is in app target. Moreover stubbed method cacheFolder works in test file (OCMockPodTestTests.m:39 and 41) but no longer works in ViewController.m which is shown in line 40
from ocmock.
I suspect you have include the AFNetworking classes twice in your binary. I think both your library includes libPods.a, meaning it will have a copy of all of those classes. Your test bundle also includes libPods.a, meaning it will have another copy of all those classes. In Xcode 5, it appears that in this situation (rather than duplicate symbol errors), that two versions of each Class get added to the ObjC runtime with the same name. NSClassFromString (which OCMock uses) will only find the first one, probably, and only mock that class. Hard class references in one or the other product will refer to the version of the Class linked with that product -- so your library version will point to the Class linked into your library, whilst your test class code will refer to the one compiled into the test bundle. OCMock will only modify one or the other.
So... try removing libPods.a from the "link binary with libraries" build phase from either your library or the test bundle. They should either be provided bundled inside your library (in which case remove from the test case), or users should be expected to include them along with your library if they are using it, in which case remove libPods from your library target (and the test case, as a consumer of the library, would then need to include it).
from ocmock.
Right. Thanks!
from ocmock.
Related Issues (20)
- Why OCPartialMockObject need exchange forwardingTargetForSelectorForRealObject HOT 2
- Using OCMArg setTo generates an error Implicit conversion HOT 1
- Please drop "v" prefix for tagged versions for a better experience with Swift Package Manager HOT 2
- Swift Package Manager support is incomplete HOT 6
- ocmock tests have problems with Xcode 13.0b2 on iOS15 HOT 3
- Documentation link is dead / goes to porn HOT 1
- Unable to access class methods +(void) while I am write down test case for my own framework -(void) instance methods are working fine using OCMock HOT 2
- OCMock not loading for macOS test target
- OCMStub an instance mthod not work as expected HOT 4
- When I OCMProtocolMock a protocol(This protocol has a method),How can I invoke the real implementation of the method HOT 4
- Mac Catalyst Support HOT 1
- Incompatible function pointer types
- A question about the andDo function
- Developer Account agnostic build scripts HOT 1
- Do not require xcpretty HOT 1
- ReadOnly Mock HOT 1
- OCMPartialMock initialized with NSConstantArray is crashing on Xcode 14.0b3 HOT 3
- `va_arg()` causes `EXC_BAD_ACCESS` in mocked objects HOT 3
- OCMVerify with CMTime argument fails on m1 mac. HOT 2
- Error in partial mock documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocmock.