PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms 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
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_maximum">
 4		<cfset loc.result = model("post").maximum(property="views")>
 5		<cfset assert("loc.result IS 5")>
 6	</cffunction>
 7
 8	<cffunction name="test_maximum_with_where">
 9		<cfset loc.result = model("post").maximum(property="views", where="title LIKE 'Title%'")>
10		<cfset assert("loc.result IS 5")>
11	</cffunction>
12
13	<cffunction name="test_maximum_with_non_matching_where">
14		<cfset loc.result = model("post").maximum(property="views", where="id=0")>
15		<cfset assert("loc.result IS ''")>
16	</cffunction>
17	
18	<cffunction name="test_maximum_with_ifNull">
19		<cfset loc.result = model("post").maximum(property="views", where="id=0", ifNull=0)>
20		<cfset assert("loc.result IS 0")>
21	</cffunction>
22
23	<cffunction name="test_maximum_with_include_soft_deletes">
24		<cftransaction action="begin">
25			<cfset loc.post = model("Post").deleteAll(where="views=5", transaction="none")>
26			<cfset loc.maximum = model("Post").maximum(property="views", includeSoftDeletes=true)>
27			<cftransaction action="rollback" />
28		</cftransaction>
29		<cfset assert('loc.maximum eq 5')>
30	</cffunction>	
31
32</cfcomponent>