Hi guys, I've just been trying to mock a call to ORM where I expect it to return null.
function mockNull(){
var Gateway = mock().getBasket().returns( JavaCast("null","") );
var result = Gateway.getBasket();
assertTrue( IsNull( Gateway.getBasket() ) );
}
This was causing the error:
variable [ARG] doesn't exist : framework\mightymock\MightyMock.cfc (232)
I thought about using a special '{null}' value as a return type so you could do something like:
function mockNull(){
var Gateway = mock().getBasket().returns( '{null}' );
var result = Gateway.getBasket();
assertTrue( IsNull( Gateway.getBasket() ) );
}
I had a go at doing this, by trapping the '{null}' argument, but haven't got it to work properly.
function returns(){
var arg = '';
_$setState('idle');
if( arguments.size() ) arg = arguments[1];
if ( !IsSimpleValue( arg ) || arg != '{null}' ){
registry.updateRegistry(currentMethod['name'],currentMethod['missingMethodArguments'],'returns',arg);
}
return this;
}
Any thoughts?
Thanks,
John