I have a class foo1 that I am unit testing. It has a function A that calls function B. Function B returns an instance of class foo2. In order to make this a true unit test, I created a mocked version of class foo2 called mockFoo2. I need to mock function B in foo1 to return mockFoo2 instead of a live version of foo2.
I am still fairly new to TestBox and MockBox, so I am not sure if this is possible. I tried using createStub on foo1 to create stubFoo1 and then the $() function to create a mocked version of function B but it didn’t seem to work as the call to function A in the stub object didn’t seem to do anything.
Also, I am a little confused as to the difference between createMock and createStub. I have read the TestBox/MockBox manual and am still unsure if I am doing this right.
Any help or suggestions would be appreciated.