PageRenderTime 46ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/model/crud/properties.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 30 lines | 26 code | 4 blank | 0 comment | 0 complexity | 852958ecafaa6c4ae5e7e9adc723da5c MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="test_updateProperty">
  3. <cftransaction action="begin">
  4. <cfset loc.author = model("Author").findOne(where="firstName='Andy'")>
  5. <cfset loc.saved = loc.author.updateProperty("firstName", "Frog")>
  6. <cftransaction action="rollback" />
  7. </cftransaction>
  8. <cfset assert('loc.saved eq true and loc.author.firstName eq "Frog"')>
  9. </cffunction>
  10. <cffunction name="test_updateProperty_dynamic_method">
  11. <cftransaction action="begin">
  12. <cfset loc.author = model("Author").findOne(where="firstName='Andy'")>
  13. <cfset loc.saved = loc.author.updateFirstName(value="Frog")>
  14. <cftransaction action="rollback" />
  15. </cftransaction>
  16. <cfset assert('loc.saved eq true and loc.author.firstName eq "Frog"')>
  17. </cffunction>
  18. <cffunction name="test_updateProperties">
  19. <cftransaction action="begin">
  20. <cfset loc.author = model("Author").findOne(where="firstName='Andy'")>
  21. <cfset loc.saved = loc.author.updateProperties(firstName="Kirmit", lastName="Frog")>
  22. <cftransaction action="rollback" />
  23. </cftransaction>
  24. <cfset assert('loc.saved eq true and loc.author.lastName eq "Frog" and loc.author.firstName eq "Kirmit"')>
  25. </cffunction>
  26. </cfcomponent>