/wheels/tests/model/properties/propertyispresent.cfc
ColdFusion CFScript | 29 lines | 24 code | 5 blank | 0 comment | 0 complexity | 09cb10e261079a5c17c196f08334394e MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
- <cfcomponent extends="wheelsMapping.Test">
-
- <cffunction name="test_returns_true_when_property_is_set">
- <cfset loc.model = model("author") />
- <cfset loc.properties = { firstName = "James", lastName = "Gibson" } />
- <cfset loc.model = loc.model.new(properties=loc.properties) />
- <cfset assert('loc.model.propertyIsPresent("firstName") eq true') />
- </cffunction>
-
- <cffunction name="test_returns_false_when_property_is_blank">
- <cfset loc.model = model("author").new() />
- <cfset loc.model.lastName = "" />
- <cfset assert('loc.model.propertyIsPresent("lastName") eq false') />
- </cffunction>
-
- <cffunction name="test_returns_false_when_property_does_not_exist">
- <cfset loc.model = model("author").new() />
- <cfset StructDelete(loc.model, "lastName")>
- <cfset assert('loc.model.propertyIsPresent("lastName") eq false') />
- </cffunction>
-
- <cffunction name="test_dynamic_method_call">
- <cfset loc.model = model("author") />
- <cfset loc.properties = { firstName = "James", lastName = "Gibson" } />
- <cfset loc.model = loc.model.new(properties=loc.properties) />
- <cfset assert('loc.model.firstNameIsPresent() eq true') />
- </cffunction>
-
- </cfcomponent>