PageRenderTime 271ms CodeModel.GetById 109ms app.highlight 1ms RepoModel.GetById 150ms app.codeStats 1ms

/wheels/tests/global/internal/$hashedkey.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 50 lines | 46 code | 4 blank | 0 comment | 0 complexity | 37065feb95b31bcc50972499f66c8e91 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_accepts_undefined_value">
 4		<cfargument name="value1" type="string" required="false" default="asdfasdf" />
 5		<cfargument name="value2" type="string" required="false" /><!--- this creates an undefined value to test $hashedKey() --->
 6		<cfset loc.e = raised('$hashedKey(argumentCollection=arguments)')>
 7		<cfset loc.r = "">
 8		<cfset assert('loc.e eq loc.r')>
 9	</cffunction>
10
11	<cffunction name="test_accepts_generated_query">
12		<cfargument name="a" type="string" required="false" default="asdfasdf" />
13		<cfargument name="b" type="query" required="false" default="#QueryNew('a,b,c,e')#" /><!--- this creates a query that does not have sql metadata --->
14		<cfset loc.e = raised('$hashedKey(argumentCollection=arguments)')>
15		<cfset loc.r = "">
16		<cfset assert('loc.e eq loc.r')>
17	</cffunction>
18
19	<cffunction name="test_same_output">
20		<cffile action="readbinary" file="#expandpath('wheels/tests/_assets/files/cfwheels-logo.png')#" variable="loc.binaryData">
21		<cftransaction action="begin">
22			<cfset loc.photo = model("photo").findOne()>
23			<cfset loc.photo.update(filename="somefilename", fileData=loc.binaryData)>
24			<cfset loc.photo = model("photo").findAll(where="id = #loc.photo.id#")>
25			<cftransaction action="rollback" />
26		</cftransaction>
27		<cfset loc.a = []>
28		<cfset loc.a[1] = "petruzzi">
29		<cfset loc.a[2] = "gibson">
30		<cfset loc.query = QueryNew('a,b,c,d,e')>
31		<cfset QueryAddRow(loc.query, 1)>
32		<cfset QuerySetCell(loc.query, "a", "tony")>
33		<cfset QuerySetCell(loc.query, "b", "per")>
34		<cfset QuerySetCell(loc.query, "c", "james")>
35		<cfset QuerySetCell(loc.query, "d", "chris")>
36		<cfset QuerySetCell(loc.query, "e", "raul")>
37		<cfset loc.a[3] = loc.query>
38		<cfset loc.a[4] = [1,2,3,4,5,6]>
39		<cfset loc.a[5] = {a=1,b=2,c=3,d=4}>
40		<cfset loc.a[6] = loc.photo>
41		<cfset loc.args = {}>
42		<cfset loc.args.a = loc.a>
43		<cfset loc.e = $hashedKey(argumentCollection=loc.args)>
44		<cfset arrayswap(loc.a, 1,3)>
45		<cfset arrayswap(loc.a, 4,5)>
46		<cfset loc.r = $hashedKey(argumentCollection=loc.args)>
47		<cfset assert('loc.e eq loc.r')>
48	</cffunction>
49
50</cfcomponent>