PageRenderTime 41ms CodeModel.GetById 20ms app.highlight 0ms RepoModel.GetById 20ms app.codeStats 0ms

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

http://cfwheels.googlecode.com/
ColdFusion CFScript | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 36d8736ea0b2d5a899d71b138b598a3a MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="setup">
 4		<cfset loc.authorModel = model("author")>
 5		<cfset loc.userModel = model("user")>
 6	</cffunction>
 7 
 8 	<cffunction name="test_objectCount_valid">
 9		<cfset loc.author = loc.authorModel.findOne(where="firstName = 'Per'")>
10		<cfset loc.postCount = loc.author.postCount() />
11		<cfset assert('loc.postCount eq 3')>
12	</cffunction>
13 
14 	<cffunction name="test_objectCount_valid_with_combi_key">
15		<cfset loc.user = loc.userModel.findByKey(key=1)>
16		<cfset loc.combiKeyCount = loc.user.combiKeyCount() />
17		<cfset assert('loc.combiKeyCount eq 1')>
18	</cffunction>
19
20 	<cffunction name="test_objectCount_returns_zero">
21		<cfset loc.author = loc.authorModel.findOne(where="firstName = 'James'")>
22		<cfset loc.postCount = loc.author.postCount() />
23		<cfset assert('loc.postCount eq 0')>
24	</cffunction>
25
26</cfcomponent>