PageRenderTime 22ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/model/onmissingmethod/hasMany/objects.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 29 lines | 24 code | 5 blank | 0 comment | 0 complexity | ae64d003af57bb498b717c3fad3c5b8f 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_objects_returns_query">
  7. <cfset loc.author = loc.authorModel.findOne(where="firstName = 'Per'")>
  8. <cfset loc.posts = loc.author.posts() />
  9. <cfset assert('IsQuery(loc.posts) eq true')>
  10. <cfset assert('loc.posts.Recordcount')>
  11. </cffunction>
  12. <cffunction name="test_objects_valid_with_combi_key">
  13. <cfset loc.user = loc.userModel.findByKey(key=1)>
  14. <cfset loc.combiKeys = loc.user.combiKeys() />
  15. <cfset assert('IsQuery(loc.combiKeys) eq true')>
  16. <cfset assert('loc.combiKeys.Recordcount')>
  17. </cffunction>
  18. <cffunction name="test_objects_returns_empty_query">
  19. <cfset loc.author = loc.authorModel.findOne(where="firstName = 'James'")>
  20. <cfset loc.posts = loc.author.posts() />
  21. <cfset assert('IsQuery(loc.posts) eq true')>
  22. <cfset assert('not loc.posts.Recordcount')>
  23. </cffunction>
  24. </cfcomponent>