PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 0ms app.codeStats 1ms

/wheels/tests/model/properties/hasproperty.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 28 lines | 23 code | 5 blank | 0 comment | 0 complexity | d5699da0bd7bd50c56d98099ea8f7d21 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_returns_true_when_property_is_set">
 4		<cfset loc.model = model("author") />
 5		<cfset loc.properties = { firstName = "James", lastName = "Gibson" } />
 6		<cfset loc.model = loc.model.new(properties=loc.properties) />
 7		<cfset assert('loc.model.hasProperty("firstName") eq true') />
 8	</cffunction>
 9
10	<cffunction name="test_returns_true_when_property_is_blank">
11		<cfset loc.model = model("author").new() />
12		<cfset assert('loc.model.hasProperty("firstName") eq true') />
13	</cffunction>
14
15	<cffunction name="test_returns_false_when_property_does_not_exist">
16		<cfset loc.model = model("author").new() />
17		<cfset StructDelete(loc.model, "lastName")>
18		<cfset assert('loc.model.hasProperty("lastName") eq false') />
19	</cffunction>
20
21	<cffunction name="test_dynamic_method_call">
22		<cfset loc.model = model("author") />
23		<cfset loc.properties = { firstName = "James", lastName = "Gibson" } />
24		<cfset loc.model = loc.model.new(properties=loc.properties) />
25		<cfset assert('loc.model.hasFirstName() eq true') />
26	</cffunction>
27
28</cfcomponent>