PageRenderTime 222ms CodeModel.GetById 119ms app.highlight 1ms RepoModel.GetById 100ms app.codeStats 0ms

/wheels/tests/model/views/views.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 27 lines | 23 code | 4 blank | 0 comment | 0 complexity | 5363b1f73124e9fa78251834902d2799 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_should_be_able_to_query_views_on_a_column">
 4		<cfset loc.view = model("ViewUserPhotoKeyUserId").findAll(where="username = 'tonyp'")>
 5		<cfset assert('loc.view.recordcount neq 0')>
 6		<cfset loc.view = model("ViewUserPhotoKeyPhotoGalleryId").findAll(where="username = 'tonyp'")>
 7		<cfset assert('loc.view.recordcount neq 0')>
 8	</cffunction>
 9
10	<cffunction name="test_should_be_able_to_query_views_on_the_specified_primary_key">
11		<cfset loc.view = model("ViewUserPhotoKeyUserId").findOne(order="userid")>
12		<cfset loc.view = model("ViewUserPhotoKeyUserId").findByKey(loc.view.userid)>
13		<cfset assert('IsObject(loc.view)')>
14		<cfset loc.view = model("ViewUserPhotoKeyPhotoGalleryId").findOne(order="galleryid")>
15		<cfset loc.view = model("ViewUserPhotoKeyPhotoGalleryId").findByKey(loc.view.galleryid)>
16		<cfset assert('IsObject(loc.view)')>
17	</cffunction>
18
19	<cffunction name="test_associations_should_still_work">
20		<cfset loc.view = model("ViewUserPhotoKeyPhotoGalleryId").findAll(
21				include="photos"
22				,where="username = 'tonyp'"
23			)>
24		<cfset assert('loc.view.recordcount neq 0')>
25	</cffunction>
26
27</cfcomponent>