Small Update to ColdMock

In response to a thread on the MXUnit forums about mocking, I've made a quick update to ColdMock. I added a method named methodCallCount(methodName) to the mock objects. This will return the number of times that the specified method has been called up to the current execution point. This might be useful if you are testing a component that makes calls to a mock object but doesn't return anything or returns void, to ensure that the call to the mock object actually happened as expected.

So you can do something like:

Call a method that retuns void: <cfset facade.doSomething() />
This call to facade.methodCallCount('doSomething') should be 1: #facade.methodCallCount('doSomething')#

		

I also added a debug method called coldMock_debug() to the mocked objects to view the internal variables scope aid in any debugging issues with mocking.

Happy mocking! nyah nyah! Oh, not that kind of mocking. ;-)

Comments
Comments are not allowed for this entry.
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1. Contact Blog Owner