PageRenderTime 1367ms CodeModel.GetById 548ms app.highlight 1ms RepoModel.GetById 135ms app.codeStats 0ms

/wheels/tests/model/calculations/minimum.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 27 lines | 22 code | 5 blank | 0 comment | 0 complexity | 936296b6794001f0e6a79512f6fede49 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_minimum">
 4		<cfset loc.result = model("post").minimum(property="views")>
 5		<cfset assert("loc.result IS 0")>
 6	</cffunction>
 7
 8	<cffunction name="test_minimum_with_non_matching_where">
 9		<cfset loc.result = model("post").minimum(property="views", where="id=0")>
10		<cfset assert("loc.result IS ''")>
11	</cffunction>
12
13	<cffunction name="test_minimum_with_ifNull">
14		<cfset loc.result = model("post").minimum(property="views", where="id=0", ifNull=0)>
15		<cfset assert("loc.result IS 0")>
16	</cffunction>
17
18	<cffunction name="test_minimum_with_include_soft_deletes">
19		<cftransaction action="begin">
20			<cfset loc.post = model("Post").deleteAll(where="views=0", transaction="none")>
21			<cfset loc.minimum = model("Post").minimum(property="views", includeSoftDeletes=true)>
22			<cftransaction action="rollback" />
23		</cftransaction>
24		<cfset assert('loc.minimum eq 0')>
25	</cffunction>
26
27</cfcomponent>