/mxunit/tests/framework/fixture/ComponentWithPrivateMethods.cfc

http://github.com/bittersweetryan/cfevernote · ColdFusion CFScript · 53 lines · 39 code · 14 blank · 0 comment · 0 complexity · 66389bc95a11059fa261c6f5141a6ea0 MD5 · raw file

  1. <cfcomponent extends="ParentWithPrivateMethods">
  2. <cffunction name="aPrivateMethod" access="private" returntype="string">
  3. <cfargument name="arg1" type="string" required="true">
  4. <cfargument name="arg2" type="string" required="true">
  5. <cfargument name="sep" type="string" required="false" default="_">
  6. <cfreturn arg1 & sep & arg2>
  7. </cffunction>
  8. <cffunction name="aNoArgPrivateMethod" access="private" returntype="string">
  9. <cfreturn "boo">
  10. </cffunction>
  11. <cffunction name="aPrivateMethodNoRT" access="private">
  12. <cfset var purpose = "no return type specified">
  13. <cfreturn purpose>
  14. </cffunction>
  15. <cffunction name="aPrivateMethodReturnArray" access="private">
  16. <cfreturn ArrayNew(1)>
  17. </cffunction>
  18. <cffunction name="aPrivateMethodReturnArray2" returntype="array" access="private">
  19. <cfreturn ArrayNew(1)>
  20. </cffunction>
  21. <cffunction name="aPrivateMethodVariedArguments" returntype="struct" access="private" output="false" hint="I return a struct matching arguments passed and/or defined by default attribute.">
  22. <cfargument name="arg1" type="string" required="true">
  23. <cfargument name="arg2" type="string" required="false" default="arg2_val">
  24. <cfargument name="arg3" type="string" required="false">
  25. <cfset var args = structNew()>
  26. <cfset var key = "">
  27. <cfloop collection="#arguments#" item="key">
  28. <cfif structKeyExists(arguments, key)><!--- all cfargument tags have a struct key in arguments, even when not passed and no default --->
  29. <cfset args[key] = arguments[key]>
  30. </cfif>
  31. </cfloop>
  32. <cfreturn args>
  33. </cffunction>
  34. <!--- this will run as constructor code --->
  35. <cfset this.x = 1>
  36. <cffunction name="aPrivateVoid" access="private" returntype="void">
  37. <cfset this.x = 5>
  38. </cffunction>
  39. </cfcomponent>