PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/model/callbacks/beforeDelete.cfc

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