PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/model/callbacks/afterDelete.cfc

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