PageRenderTime 37ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

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