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

/wheels/tests/model/views/views.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 27 lines | 23 code | 4 blank | 0 comment | 0 complexity | 5363b1f73124e9fa78251834902d2799 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="test_should_be_able_to_query_views_on_a_column">
  3. <cfset loc.view = model("ViewUserPhotoKeyUserId").findAll(where="username = 'tonyp'")>
  4. <cfset assert('loc.view.recordcount neq 0')>
  5. <cfset loc.view = model("ViewUserPhotoKeyPhotoGalleryId").findAll(where="username = 'tonyp'")>
  6. <cfset assert('loc.view.recordcount neq 0')>
  7. </cffunction>
  8. <cffunction name="test_should_be_able_to_query_views_on_the_specified_primary_key">
  9. <cfset loc.view = model("ViewUserPhotoKeyUserId").findOne(order="userid")>
  10. <cfset loc.view = model("ViewUserPhotoKeyUserId").findByKey(loc.view.userid)>
  11. <cfset assert('IsObject(loc.view)')>
  12. <cfset loc.view = model("ViewUserPhotoKeyPhotoGalleryId").findOne(order="galleryid")>
  13. <cfset loc.view = model("ViewUserPhotoKeyPhotoGalleryId").findByKey(loc.view.galleryid)>
  14. <cfset assert('IsObject(loc.view)')>
  15. </cffunction>
  16. <cffunction name="test_associations_should_still_work">
  17. <cfset loc.view = model("ViewUserPhotoKeyPhotoGalleryId").findAll(
  18. include="photos"
  19. ,where="username = 'tonyp'"
  20. )>
  21. <cfset assert('loc.view.recordcount neq 0')>
  22. </cffunction>
  23. </cfcomponent>