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?