Hello Guys,
I’m running some integration tests, and need access to the FlashRAM to ensure that things are being placed as I would expect.
I’ve dump the event object in the test but can’t see any methods for accessing the Flash.
Any ideas?
Robert
Hello Guys,
I’m running some integration tests, and need access to the FlashRAM to ensure that things are being placed as I would expect.
I’ve dump the event object in the test but can’t see any methods for accessing the Flash.
Any ideas?
Robert
You should be able to do this.
controller.getRequestService().getFlashScope()
Regards,
Andrew Scott
Thanks for the response Andrew.
Where is the 'controller' variable coming from?
Can you explain a little more.
Thanks mate,
Robert
It depends on whether you are extending with the BaseTestCase or the BaseHandlerTest
If you are using the former then you can just do getController()getRequestService().getFlashScope();
Not sure if you using the latter.
Regards,
Andrew Scott
In 3.0, a MockFlash exists to support your tests. Check out this link: http://wiki.coldbox.org/wiki/WhatsNew:3.0.0.cfm#Unit/Integration_Testing_Enhancements
As long as you properly extend “coldbox.system.testing.BaseTestCase” you can access getFlashScope().
For handlers, if you extend “coldbox.system.testing.BaseHandlerTest” you can access “mockFlash”.
Each core peice of the framework has a base object for tests which already mocks framework components like the Flash scope.
Aaron Greenlee
http://aarongreenlee.com/
Thanks Aaron and Andrew,
I’ve used getFlashScope() and it appears to work a treat!
Thanks,
Robert
Yeah I didn’t know getFlashScope() was there as a wrapper for the other way, but it’s good to know for future reference.
Regards,
Andrew Scott
The best friend you will ever have: http://coldbox.org/documents/api/ColdBoxDocs-3.0.0/index.html
Luis F. Majano
President
Ortus Solutions, Corp
ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com