Module Controller Test Case
ModuleCtrlTestCase provides helper methods to instantiate and test module controllers. The class is designed to monitor all events and server connections made by a module.
On top of the assert methods that it inherits from Test Case, it provides the following:
assertLogsNotClean: Asserts that there is no error in the logs, it is similar to assertLogsEmpty but it also checks for connection errors.
The class has also the attribute cxLogs, an array of ConnectionSession. These objects contain information on every request that is done through the module controller.
ModuleCtrlTestCase is able to automatically create and dispose the instance of Module Controller under test.
$controller in the test's
$prototype an instance of that class is generated before running the test.
Inside the test methods you can access the two variables
$moduleCtrl gives a wrapper which offers only the methods and fields exposed via the interface,
$moduleCtrlPrivate gives direct access to the module controller.
The public interface is also registered for asserting its logs, so there's no need to call
The test makes sure that objects are created and disposed correctly off-loading some work from the developer.
$controller can be either a string or an object. If it's a string it's considered as a classpath,
if it's an object it must match the bean InitModuleController. This allow to pass initArgs to the module's
It is also possible to manually create an instance with the following code: