After seeing the video from Luis about setting up the testing options
of Coldbox, I decided to finally give proper testing a serious look.
Something I always wanted to do, but never took the time to
I have set up my environment according to the video, did the basic
tests to check if the Welcome message was set, and everything works
But now I want to test my own handlers, for which I use ORM. I have
enabled ORM in the application.cfc of the test suite, because at first
I got an error saying that ORM was nog enabled.
Now I call event, products.showcategory. It call the productservice
and puts an object in the request collection.
But when I run a test, calling the event en debug the output on the
screen via debug(event.getCollection()), I get the following error:
Result: railo.runtime.exp.NativeException: failed to lazily initialize
a collection, no session or session was closed.
I have checked if session variables were enabled in my Application.cfc
in the test directory, but that is the case.
Are there some extra steps to take when debugging a ORM handler? For
your information, I am using an actual ProductService.cfc, which is
injected by Wirebox into my handler. But that is all handled in the
product handler, so the test handler does not need to know about this,
This is the code in my handler:
var event = "";
//Place any variables on the form or URL scope to test the handler.
URL.id = "5"
event = execute("product.tooncategorie");
And this is the original handler event:
var rc = event.getCollection();
rc.start = Event.getValue('startrow', '1');
Am I overlooking something here?
Hope you can help,