<cffunction name="testSomething">
<cfset obj = createObject(".....)>
<cfset makeVariablePublic(obj,"myPrivateVariable")>
<cfset obj.myPrivateVariable = "foo">
....
</cffunction>
Is that what you have in mind?
<cfset mockProperty(obj=objUnderTest,property="foo",propertyValue="myNewFooValue")>
Can you help me see the cases where this wouldn't suffice?
thanks a lot!
marc
I'm assuming you had a use case / need for this, possibly for coldbox.
What is it that you're doing?
I'm asking because when we put this stuff in there, naturally we're
going to add it to the docs, and I want to make sure i thoroughly
understand the problem it solves so i can come up with good examples.
thanks luis.
marc
So in that case, why not do a makePublic on the setter, like so:
<cfset makePublic(objUnderTest,"mySetter")>
<cfset objUnderTest.mySetter(something)>
?
this is fun, luis!
marc
A common Java technique is to create a test object that extends the
object being tested and have it expose setters to manipulate the
internal state. That way you don't need to do any hackery at all
(since "private" in CF is really protected in the Java sense).
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
Almost all of the code was written a day or two after Luis first
posted his question, but I couldn't find the time to do the
documentation until this week, and we're trying to get in the habit of
only putting out new versions when the documentation is sufficient.
marc