PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/wheels/tests/model/properties/propertyispresent.cfc

http://cfwheels.googlecode.com/
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
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="test_returns_true_when_property_is_set">
  3. <cfset loc.model = model("author") />
  4. <cfset loc.properties = { firstName = "James", lastName = "Gibson" } />
  5. <cfset loc.model = loc.model.new(properties=loc.properties) />
  6. <cfset assert('loc.model.propertyIsPresent("firstName") eq true') />
  7. </cffunction>
  8. <cffunction name="test_returns_false_when_property_is_blank">
  9. <cfset loc.model = model("author").new() />
  10. <cfset loc.model.lastName = "" />
  11. <cfset assert('loc.model.propertyIsPresent("lastName") eq false') />
  12. </cffunction>
  13. <cffunction name="test_returns_false_when_property_does_not_exist">
  14. <cfset loc.model = model("author").new() />
  15. <cfset StructDelete(loc.model, "lastName")>
  16. <cfset assert('loc.model.propertyIsPresent("lastName") eq false') />
  17. </cffunction>
  18. <cffunction name="test_dynamic_method_call">
  19. <cfset loc.model = model("author") />
  20. <cfset loc.properties = { firstName = "James", lastName = "Gibson" } />
  21. <cfset loc.model = loc.model.new(properties=loc.properties) />
  22. <cfset assert('loc.model.firstNameIsPresent() eq true') />
  23. </cffunction>
  24. </cfcomponent>