I know I can override the methods manually. Mockbox wouldn't be nearly as useful if I couldn't. :)
Given this class..
=======================
component {
array function getSomething() { return getArray() };
array function getArray() { return [1,2,3] };
}
And this test...
=======================
it("the default return was overridden", function(){
myMock = createMock('some.path');
expect(myMock.getSomething()).toBe( [1,2,3] );
})
I ran that test and it passed. Mockbox didn't inherently override getArray() like I expected. In Mockito, it _would_ have. By default, all methods are replaced with mocked methods that return specific data based upon the return type.
This is the manual way I've been doing in the past
======================================
it("the default return was overridden", function(){
myMock = createMock('some.path').$('getArray',[]);
expect(myMock.getSomething()).toBe( [1,2,3] );
})
Does that better explain it? Perhaps I should be using something other than createMock()?