/wheels/tests/model/calculations/maximum.cfc
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
- <cfcomponent extends="wheelsMapping.Test">
-
- <cffunction name="test_maximum">
- <cfset loc.result = model("post").maximum(property="views")>
- <cfset assert("loc.result IS 5")>
- </cffunction>
-
- <cffunction name="test_maximum_with_where">
- <cfset loc.result = model("post").maximum(property="views", where="title LIKE 'Title%'")>
- <cfset assert("loc.result IS 5")>
- </cffunction>
-
- <cffunction name="test_maximum_with_non_matching_where">
- <cfset loc.result = model("post").maximum(property="views", where="id=0")>
- <cfset assert("loc.result IS ''")>
- </cffunction>
-
- <cffunction name="test_maximum_with_ifNull">
- <cfset loc.result = model("post").maximum(property="views", where="id=0", ifNull=0)>
- <cfset assert("loc.result IS 0")>
- </cffunction>
-
- <cffunction name="test_maximum_with_include_soft_deletes">
- <cftransaction action="begin">
- <cfset loc.post = model("Post").deleteAll(where="views=5", transaction="none")>
- <cfset loc.maximum = model("Post").maximum(property="views", includeSoftDeletes=true)>
- <cftransaction action="rollback" />
- </cftransaction>
- <cfset assert('loc.maximum eq 5')>
- </cffunction>
-
- </cfcomponent>