[Testbox 2.1.0] - Method counters not working?

I am confused. I have an xUnit test case, the function as follows:

public function testNotify(){
local.oListenerService = createObject(variables.sModelPath).init();
local.oMockObserverService = createObject(‘component’, ‘test.mocks.mockObserverService’);
mockbox.prepareMock(local.oMockObserverService);
local.oListenerService.register(local.oMockObserverService);
local.oListenerService.notify(‘test topic’, {});
debug(local.oMockObserverService.$count(‘notify’)); // Shows -1
$assert.isTrue(local.oMockObserverService.$once(‘notify’)); // Assertion fails.
}

The assertion at the end fails as if the ListenerService never passes on a notify() call to my Observer. However, I know that it does indeed call it, because if I put a in the Observer’s notify() function, I get the dump/abort.

I grabbed the latest Testbox (with Mockbox included) and from the website and the versions listed in system\Testbox.cfc and Mockbox.cfc are the same as in the new .zip I downloaded.

Yes, by the way, I have tried adding a true flag to the prepareMock() call, but true is the default anyway. Made no difference. The mock object, when dumped, shows that _MockCallLoggingActive=true, though the _MockCallLoggers struct is empty.

Stumped. Thoughts, anyone? Am I using it wrong?

Yes. You are not mocking the function. You need to mock the function do mock box can track it.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057

You are right, I did forget that. But now when I add the mock with $(‘notify’)…I keep getting errors that I’m not meeting my interface. Is that any kind of known issue?