Skip to content
Browse files

GitHub Task 4: provide getters/setters on expected/actual in Assert/T…

…estCase; all tests failing due to this bug are now passing
  • Loading branch information...
1 parent c6f88d6 commit fc5cf4cb4f963210eef6a5fd041667753bdbc046 @marcesher marcesher committed Aug 1, 2011
View
2 framework/TestCase.cfc
@@ -503,7 +503,7 @@
<cfset decoratorNames = arguments.object.getAnnotation(annotationName="decorators") />
<cfset decoratorNames = listPrepend( decoratorNames, getRequiredDecoratorPaths() ) />
-<cflog text="#decoratorNames#" >
+
<cfloop list="#decoratorNames#" index="decoratorPath">
<cfset decorator = createObject("component", decoratorPath)/>
<cfset decorator.setTarget(object)/>
View
13 framework/TestDecorator.cfc
@@ -44,6 +44,11 @@
<cfreturn getTarget().getRunnableMethods() />
</cffunction>
+<cffunction name="setMockingFramework" access="public" output="false">
+ <cfargument name="name" type="Any" required="true" />
+ <cfset getTarget().setMockingFramework(argumentCollection=arguments) />
+</cffunction>
+
<cffunction name="initDebug" access="public" output="false">
<cfreturn getTarget().initDebug() />
</cffunction>
@@ -72,6 +77,14 @@
<cfset getTarget().clearClassVariables()>
</cffunction>
+<cffunction name="getExpected" access="public">
+ <cfreturn getTarget().getExpected() />
+</cffunction>
+
+<cffunction name="getActual" access="public">
+ <cfreturn getTarget().getActual() />
+</cffunction>
+
<cffunction name="getTarget" hint="get the current Target. May actually be another decorator." access="public" returntype="any" output="false">
<cfreturn instance.target />
</cffunction>
View
2 framework/TestSuiteRunner.cfc
@@ -104,7 +104,7 @@
<cfset results.addContent(outputOfTest) />
<cfcatch type="mxunit.exception.AssertionFailedError">
- <cfset addFailureToResults(results=results,expected=testCase.expected,actual=testCase.actual,exception=cfcatch,content=outputOfTest)>
+ <cfset addFailureToResults(results=results, expected=testCase.getExpected(), actual=testCase.getActual(), exception=cfcatch, content=outputOfTest)>
</cfcatch>
<cfcatch type="any">
View
11 tests/framework/RemoteFacadeObjectCacheTest.cfc
@@ -59,22 +59,23 @@
<cfset var path = "mxunit.PluginDemoTests.SingleMethodTest">
<cfset var obj = variables.cache.getObject(path,"")>
<cfset var md = getMetadata(obj)>
- <cfset assertEquals(path,md.name)>
+ <cfset assertEquals(path, md.name)>
<cfset variables.cache.purgeSuitePool()>
</cffunction>
<cffunction name="testGetObjectWhenCachePurged">
<cfset var path = "mxunit.PluginDemoTests.SingleMethodTest">
<cfset var key = variables.cache.startTestRun()>
- <cfset var obj = variables.cache.getObject(path,key)>
+ <!--- we need getBaseTarget because by the time the test gets run, it'll possibly be wrapped in a decorator --->
+ <cfset var obj = variables.cache.getObject(path, key).getBaseTarget()>
<cfset var md = getMetadata(obj)>
- <cfset assertEquals(path,md.name)>
+ <cfset assertEquals(path, md.name)>
<cfset variables.cache.purgeSuitePool()>
- <cfset obj = variables.cache.getObject(path,key)>
+ <cfset obj = variables.cache.getObject(path, key).getBaseTarget()>
<cfset md = getMetadata(obj)>
- <cfset assertEquals(path,md.name)>
+ <cfset assertEquals(path, md.name)>
<cfset variables.cache.purgeSuitePool()>
</cffunction>
View
2 tests/mightymock/ArgumentMatcherTest.cfc
@@ -140,7 +140,7 @@ function findByPatternTestWithNamedArgs(){
}
-function matchLiterlToPatterns(){
+function matchLiteralToPatterns(){
var actual = false;
var literal = { 1='bar', 2=321654};
var pattern = { 1='{string}', 2='{numeric}'};

0 comments on commit fc5cf4c

Please sign in to comment.
Something went wrong with that request. Please try again.