lithium\test\Controller::__invoke()
Magic method to make Controller callable.
Parameters
-
\lithium\action\Request
$request
-
array
$dispatchParams
Array of params after being parsed by router.
-
array
$options
Some basic options for this controller.
Returns
stringFilter
This method can be filtered.
Source
public function __invoke($request, $dispatchParams, array $options = []) {
$dispatchParamsDefaults = ['args' => []];
$dispatchParams += $dispatchParamsDefaults;
$defaults = ['format' => 'html', 'timeout' => 0];
$options += (array) $request->query + $defaults;
$params = compact('request', 'dispatchParams', 'options');
return Filters::run($this, __FUNCTION__, $params, function($params) {
$request = $params['request'];
$options = $params['options'];
$params = $params['dispatchParams'];
set_time_limit((integer) $options['timeout']);
$group = join('\\', (array) $params['args']);
if ($group === "all") {
$group = Group::all();
$options['title'] = 'All Tests';
}
$this->_saveCtrlContext();
$report = Dispatcher::run($group, $options);
$this->_restoreCtrlContext();
$filters = Libraries::locate('test.filter');
$menu = Libraries::locate('tests', null, [
'filter' => '/cases|integration|functional/',
'exclude' => '/mocks/'
]);
sort($menu);
$menu = Set::expand(array_combine($menu, $menu), ['separator' => "\\"]);
$result = compact('request', 'report', 'filters', 'menu');
return $report->render('layout', $result);
});
}