PageRenderTime 660ms CodeModel.GetById 642ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/model/onmissingmethod/hasone/hasobject.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 8456eb274d86d8ceeddd992d85770e2b MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset loc.authorModel = model("author")>
  4. <cfset loc.userModel = model("user")>
  5. </cffunction>
  6. <cffunction name="test_hasObject_valid">
  7. <cfset loc.author = loc.authorModel.findOne(where="firstName = 'Per'")>
  8. <cfset loc.hasProfile = loc.author.hasProfile() />
  9. <cfset assert('loc.hasProfile eq true')>
  10. </cffunction>
  11. <cffunction name="test_hasObject_valid_with_combi_key">
  12. <cfset loc.user = loc.userModel.findByKey(key=1)>
  13. <cfset loc.hasCombiKey = loc.user.hasCombiKey() />
  14. <cfset assert('loc.hasCombiKey eq true')>
  15. </cffunction>
  16. <cffunction name="test_hasObject_returns_false">
  17. <cfset loc.author = loc.authorModel.findOne(where="firstName = 'James'")>
  18. <cfset loc.hasProfile = loc.author.hasProfile() />
  19. <cfset assert('loc.hasProfile eq false')>
  20. </cffunction>
  21. </cfcomponent>