Forgive me if this makes no sense; I'm trying to get my head around
unit testing / mocking.
I'm trying to write a test for my model's saveBox function. It takes
a transfer bean of type box.box - checks if it is valid then saves it
(using boxService) or throws an error.
So how would I go about mocking a transfer bean? Or am I getting the
wrong end of the stick?
Cheers!
My test so far:
<cfcomponent extends="coldbox.system.testing.BaseModelTest"
appMapping="/ppp">
<cffunction name="setUp" returntype="void" output="false">
<cfscript>
super.setup();
boxModel = getMockBox().createMock(className="model.BoxModel");
</cfscript>
</cffunction>
<cffunction name="testSave" returntype="void" output="false">
<cfscript>
box = // mock transfer object here and set some properties on it?
boxModel.saveBox(box );
</cfscript>
</cffunction>
</cfcomponent>