I’m trying out the new BaseHandlerTest but running into problems. It appears to be a problem with the test not being able to find the controller when executing events.
I get the following error:
The getSetting method was not found.
Either there are no methods with the specified method name and argument types or the getSetting method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
I shrunk down the stack trace a bit.
C:…\system\testing\BaseTestCase.cfc (336)
C:…\system\testing\BaseTestCase.cfc (355)
C:…\BH\test\handler\GeneralTest.cfc (32)
I only get this error when I use the execute method to run an event. I’m not sure what is going on but after digging through the code for BaseHandlerTest and BaseTestCase it appears that the controller is never being setup. If I do a dump of getController() I get “0” which is the default value for instance.controller. And of course, getController() returns instance.controller.
In BaseHandlerTest, variables.mockController is setup but I’m not sure if it is the same instance.controller in BaseTestCase.
Am I setting up something incorrectly or is this a bug? I’m guessing I’m doing something wrong but I can’t put my finger on it.