PageRenderTime 93ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://cfwheels.googlecode.com/
ColdFusion CFScript | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 36d8736ea0b2d5a899d71b138b598a3a 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_objectCount_valid">
  7. <cfset loc.author = loc.authorModel.findOne(where="firstName = 'Per'")>
  8. <cfset loc.postCount = loc.author.postCount() />
  9. <cfset assert('loc.postCount eq 3')>
  10. </cffunction>
  11. <cffunction name="test_objectCount_valid_with_combi_key">
  12. <cfset loc.user = loc.userModel.findByKey(key=1)>
  13. <cfset loc.combiKeyCount = loc.user.combiKeyCount() />
  14. <cfset assert('loc.combiKeyCount eq 1')>
  15. </cffunction>
  16. <cffunction name="test_objectCount_returns_zero">
  17. <cfset loc.author = loc.authorModel.findOne(where="firstName = 'James'")>
  18. <cfset loc.postCount = loc.author.postCount() />
  19. <cfset assert('loc.postCount eq 0')>
  20. </cffunction>
  21. </cfcomponent>