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

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

http://cfwheels.googlecode.com/
ColdFusion CFScript | 29 lines | 24 code | 5 blank | 0 comment | 0 complexity | ae64d003af57bb498b717c3fad3c5b8f 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_objects_returns_query">
 9		<cfset loc.author = loc.authorModel.findOne(where="firstName = 'Per'")>
10		<cfset loc.posts = loc.author.posts() />
11		<cfset assert('IsQuery(loc.posts) eq true')>
12		<cfset assert('loc.posts.Recordcount')>
13	</cffunction>
14 
15 	<cffunction name="test_objects_valid_with_combi_key">
16		<cfset loc.user = loc.userModel.findByKey(key=1)>
17		<cfset loc.combiKeys = loc.user.combiKeys() />
18		<cfset assert('IsQuery(loc.combiKeys) eq true')>
19		<cfset assert('loc.combiKeys.Recordcount')>
20	</cffunction>
21
22 	<cffunction name="test_objects_returns_empty_query">
23		<cfset loc.author = loc.authorModel.findOne(where="firstName = 'James'")>
24		<cfset loc.posts = loc.author.posts() />
25		<cfset assert('IsQuery(loc.posts) eq true')>
26		<cfset assert('not loc.posts.Recordcount')>
27	</cffunction>
28
29</cfcomponent>