PageRenderTime 27ms CodeModel.GetById 22ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/wheels/tests/model/crud/findonebyxxx.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 42 lines | 33 code | 9 blank | 0 comment | 0 complexity | 1c1b4422e3e5d6cf068c0427792977ac MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="setup">
 4		<cfset results = {}>
 5	</cffunction>
 6
 7	<cffunction name="test_one_value">
 8		<cfset results.user = model("user").findOneByFirstname('Per')>
 9		<cfset assert("IsObject(results.user)")>
10	</cffunction>
11
12	<cffunction name="test_explicit_arguments">
13		<cfset results.user = model("user").findOneByZipCode(value="22222", select="id,lastName,zipCode")>
14		<cfset assert("IsObject(results.user) AND results.user.lastName IS 'Peters' AND NOT StructKeyExists(results.user, 'firstName')")>
15	</cffunction>
16
17	<cffunction name="test_pass_through_order">
18		<cfset results.user = model("user").findOneByIsActive(value="1", order="zipCode DESC")>
19		<cfset assert("IsObject(results.user) AND results.user.lastName IS 'Riera'")>
20	</cffunction>
21
22	<cffunction name="test_two_values">
23		<cfset results.user = model("user").findOneByFirstNameAndLastName("Per,Djurner")>
24		<cfset assert("IsObject(results.user) AND results.user.lastName IS 'Djurner'")>
25	</cffunction>
26
27	<cffunction name="test_two_values_with_space">
28		<cfset results.user = model("user").findOneByFirstNameAndLastName("Per, Djurner")>
29		<cfset assert("IsObject(results.user) AND results.user.lastName IS 'Djurner'")>
30	</cffunction>
31
32	<cffunction name="test_two_values_with_explicit_arguments">
33		<cfset results.user = model("user").findOneByFirstNameAndLastName(values="Per,Djurner")>
34		<cfset assert("IsObject(results.user) AND results.user.lastName IS 'Djurner'")>
35	</cffunction>
36
37	<cffunction name="test_text_data_type">
38		<cfset results.profile = model("profile").findOneByBio("ColdFusion Developer")>
39		<cfset assert("IsObject(results.profile)")>
40	</cffunction>
41
42</cfcomponent>