PageRenderTime 322ms CodeModel.GetById 100ms app.highlight 1ms RepoModel.GetById 112ms app.codeStats 69ms

/wheels/tests/model/callbacks/beforeValidationOnCreate.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 21 lines | 16 code | 5 blank | 0 comment | 0 complexity | b0d1917caa46121a8e134070946132a4 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="setup">
 4		<cfset model("tag").$registerCallback(type="beforeValidationOnCreate", methods="callbackThatSetsProperty,callbackThatReturnsFalse")>
 5	</cffunction>
 6	
 7	<cffunction name="teardown">
 8		<cfset model("tag").$clearCallbacks(type="beforeValidationOnCreate")>
 9	</cffunction>
10
11	<cffunction name="test_new_object">
12		<cfset loc.obj = model("tag").create()>
13		<cfset assert("StructKeyExists(loc.obj, 'setByCallback')")>
14	</cffunction>
15	
16	<cffunction name="test_new_object_with_skipped_callback">
17		<cfset loc.obj = model("tag").create(name="mustSetAtLeastOnePropertyOrCreateFails", transaction="rollback", callbacks=false)>
18		<cfset assert("NOT StructKeyExists(loc.obj, 'setByCallback')")>
19	</cffunction>
20
21</cfcomponent>