Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

GitHub issue 12 (removed arguments in the generated component in Publ…

…icProxyMaker.cfc); GitHub issue 11 (cfsetting enablecfoutputonly=true in HttpAntRunner.cfc causes cfsavecontent issues). For Issue 11, I am temporarily removing that in order to assess its impact in the wild.
  • Loading branch information...
commit 9fd5a8932896674c5148e27343e1698c0778f647 1 parent 94cff28
@marcesher marcesher authored
View
7 framework/PublicProxyMaker.cfc
@@ -41,15 +41,16 @@
<cfset handleDirectoryCreate(dir)>
- <!--- generate a CFC that contains a public method. this method will call the private method we want to call --->
- <cfset s_argTags = constructArgumentsTags(methodStruct)>
+ <!--- NOTE: see https://github.com/mxunit/mxunit/issues/12 --->
+ <!---<cfset s_argTags = constructArgumentsTags(methodStruct)>--->
+ <!--- generate a CFC that contains a public method. this method will call the private method we want to call --->
<cfoutput>
<cfsavecontent variable="output">
<%cfcomponent extends="#md.name#"%>
<%cffunction name="#arguments.proxyMethodName#" access="public"%>
- #s_argTags#
+ <!---#s_argTags#--->
<%cf#componentReturnTag# #renamedExistingMethod#(argumentCollection=arguments)%>
<%/cffunction%>
View
6 runner/HttpAntRunner.cfc
@@ -1,6 +1,7 @@
<cfcomponent output="true">
- <cfsetting enablecfoutputonly="true" showdebugoutput="false">
-
+<cfsetting enablecfoutputonly="false" showdebugoutput="false">
+<cfprocessingdirective suppresswhitespace="true">
+
<cffunction name="run" access="remote" output="true" returntype="void" hint="Generates and prints HTML, JUnit style XML, or XML data based on a directory of tests.">
<cfargument name="type" type="string" hint="Specifies the type to run: TestCase(testcase) or Directory Path (dir)" required="true" />
<cfargument name="value" type="string" hint="The value for the type: com.foo.MyTestCase or C:/my/tests/" required="true" />
@@ -89,4 +90,5 @@
<cfset printResults(arguments.outputformat,results) /> --->
<cfreturn />
</cffunction>
+</cfprocessingdirective>
</cfcomponent>
View
16 tests/framework/PublicProxyMakerTest.cfc
@@ -91,7 +91,7 @@
</cffunction>
<cffunction name="testMakePublicNonExistentMethod" mxunit:expectedException="Application">
- <cfset this.maker.makePublic(this.objectWithPrivateMethod,"aPrivateMethodThatDoesNotExist")>
+ <cfset this.maker.makePublic(this.objectWithPrivateMethod,"aPrivateMethodThatDoesNotExist")>
</cffunction>
<cffunction name="testMakePublicNoThirdArg">
@@ -101,6 +101,20 @@
<cfset result = this.objectWithPrivateMethod.aPrivateMethod(arg1="one",arg2="two")>
<cfset assertEquals("one_two",result)>
</cffunction>
+
+ <cffunction name="testMakePublicAddInts" returntype="void">
+ <cfset var result = "">
+ <cfset this.maker.makePublic(this.objectWithPrivateMethod, "privateAddition")>
+ <cfset result = this.objectWithPrivateMethod.privateAddition(2, 5)>
+ <cfset assertEquals( 7, result )>
+ </cffunction>
+
+ <cffunction name="testMakePublicComplexArgsWithDefaults" returntype="void">
+ <cfset var result = "">
+ <cfset this.maker.makePublic(this.objectWithPrivateMethod, "privateStructAndArrayArgs")>
+ <cfset result = this.objectWithPrivateMethod.privateStructAndArrayArgs()>
+ <cfset assertEquals( {array=[]}, result )>
+ </cffunction>
<cffunction name="testMakePublicNoArgMethod">
<cfset var ret = "" />
View
13 tests/framework/fixture/ComponentWithPrivateMethods.cfc
@@ -7,6 +7,19 @@
<cfargument name="sep" type="string" required="false" default="_">
<cfreturn arg1 & sep & arg2>
</cffunction>
+
+ <cffunction name="privateAddition" output="false" access="private" returntype="any" hint="">
+ <cfargument name="val1" type="numeric" required="true"/>
+ <cfargument name="val2" type="numeric" required="true"/>
+ <cfreturn val1 + val2>
+ </cffunction>
+
+ <cffunction name="privateStructAndArrayArgs" output="false" access="private" returntype="any" hint="">
+ <cfargument name="val1" type="struct" required="false" default="#{}#"/>
+ <cfargument name="val2" type="array" required="true" default="#[]#"/>
+ <cfset val1["array"] = val2>
+ <cfreturn val1>
+ </cffunction>
<cffunction name="aNoArgPrivateMethod" access="private" returntype="string">
<cfreturn "boo">
Please sign in to comment.
Something went wrong with that request. Please try again.