PageRenderTime 49ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/model/calculations/maximum.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 32 lines | 26 code | 6 blank | 0 comment | 0 complexity | a2c73b7f46dd577a5a80f93ef78f29b4 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="test_maximum">
  3. <cfset loc.result = model("post").maximum(property="views")>
  4. <cfset assert("loc.result IS 5")>
  5. </cffunction>
  6. <cffunction name="test_maximum_with_where">
  7. <cfset loc.result = model("post").maximum(property="views", where="title LIKE 'Title%'")>
  8. <cfset assert("loc.result IS 5")>
  9. </cffunction>
  10. <cffunction name="test_maximum_with_non_matching_where">
  11. <cfset loc.result = model("post").maximum(property="views", where="id=0")>
  12. <cfset assert("loc.result IS ''")>
  13. </cffunction>
  14. <cffunction name="test_maximum_with_ifNull">
  15. <cfset loc.result = model("post").maximum(property="views", where="id=0", ifNull=0)>
  16. <cfset assert("loc.result IS 0")>
  17. </cffunction>
  18. <cffunction name="test_maximum_with_include_soft_deletes">
  19. <cftransaction action="begin">
  20. <cfset loc.post = model("Post").deleteAll(where="views=5", transaction="none")>
  21. <cfset loc.maximum = model("Post").maximum(property="views", includeSoftDeletes=true)>
  22. <cftransaction action="rollback" />
  23. </cftransaction>
  24. <cfset assert('loc.maximum eq 5')>
  25. </cffunction>
  26. </cfcomponent>