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

/wheels/tests/model/onmissingmethod/hasMany/deleteobject.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 19 lines | 16 code | 3 blank | 0 comment | 0 complexity | 54869a2ef95538a5d75cb06cf4c2c207 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="setup">
 4		<cfset loc.authorModel = model("author")>
 5	</cffunction>
 6 
 7 	<cffunction name="test_deleteObject_valid">
 8		<cfset loc.author = loc.authorModel.findOne(where="firstName = 'Per'")>
 9		<cfset loc.post = loc.author.findOnePost(order="id")>
10		<cftransaction action="begin">
11			<cfset loc.updated = loc.author.deletePost(loc.post) />
12			<cfset loc.post = model("post").findByKey(key=loc.post.id) />
13			<cfset assert('loc.updated eq true')>
14			<cfset assert('not IsObject(loc.post) and loc.post eq false')>
15			<cftransaction action="rollback" />
16		</cftransaction>
17	</cffunction>
18
19</cfcomponent>