Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 63 lines (55 sloc) 1.912 kb
8bfcfe4 @gwoo updating test suite handling. Re-Adding `\test\Controller` for browser b...
gwoo authored
1 <?php
2 /**
3 * Lithium: the most rad php framework
4 *
4f1a9c0 @nateabele Updating copyright year.
nateabele authored
5 * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
8bfcfe4 @gwoo updating test suite handling. Re-Adding `\test\Controller` for browser b...
gwoo authored
6 * @license http://opensource.org/licenses/bsd-license.php The BSD License
7 */
8
9 namespace lithium\test;
10
11 use lithium\test\Dispatcher;
12 use lithium\core\Libraries;
13 use lithium\test\Group;
14
15 /**
16 * The Test Controller for running the html version of the test suite
17 *
18 */
19 class Controller extends \lithium\core\Object {
20
21 /**
22 * Magic method to make Controller callable.
23 *
11018ba @nateabele Fixing coding standards issues with `@see` tags.
nateabele authored
24 * @see lithium\action\Dispatcher::_callable()
8bfcfe4 @gwoo updating test suite handling. Re-Adding `\test\Controller` for browser b...
gwoo authored
25 * @param object $request A \lithium\action\Request object.
26 * @param array $dispatchParams Array of params after being parsed by router.
27 * @param array $options Some basic options for this controller.
28 * @return string
59cb735 @nateabele Ensuring `@filter` tags are present in docblocks that support filtering....
nateabele authored
29 * @filter
8bfcfe4 @gwoo updating test suite handling. Re-Adding `\test\Controller` for browser b...
gwoo authored
30 */
31 public function __invoke($request, $dispatchParams, array $options = array()) {
32 $dispatchParamsDefaults = array('args' => array());
33 $dispatchParams += $dispatchParamsDefaults;
0a74653 @gwoo allowing \test\Controller timeout to be set via params.
gwoo authored
34 $defaults = array('reporter' => 'html', 'format' => 'html', 'timeout' => 0);
8bfcfe4 @gwoo updating test suite handling. Re-Adding `\test\Controller` for browser b...
gwoo authored
35 $options += (array) $request->query + $defaults;
36 $params = compact('request', 'dispatchParams', 'options');
37
38 return $this->_filter(__METHOD__, $params, function($self, $params) {
39 $request = $params['request'];
40 $options = $params['options'];
41 $params = $params['dispatchParams'];
0a74653 @gwoo allowing \test\Controller timeout to be set via params.
gwoo authored
42 set_time_limit((integer) $options['timeout']);
6c0a90e @nateabele Modifying test suite results display to remove leading backslash, and re...
nateabele authored
43 $group = join('\\', (array) $params['args']);
8bfcfe4 @gwoo updating test suite handling. Re-Adding `\test\Controller` for browser b...
gwoo authored
44
6c0a90e @nateabele Modifying test suite results display to remove leading backslash, and re...
nateabele authored
45 if ($group === "all") {
8bfcfe4 @gwoo updating test suite handling. Re-Adding `\test\Controller` for browser b...
gwoo authored
46 $group = Group::all();
47 $options['title'] = 'All Tests';
48 }
0a74653 @gwoo allowing \test\Controller timeout to be set via params.
gwoo authored
49 $report = Dispatcher::run($group, $options);
8bfcfe4 @gwoo updating test suite handling. Re-Adding `\test\Controller` for browser b...
gwoo authored
50 $filters = Libraries::locate('test.filter');
51 $menu = Libraries::locate('tests', null, array(
52 'filter' => '/cases|integration|functional/',
53 'exclude' => '/mocks/'
54 ));
55 sort($menu);
56
57 $result = compact('request', 'report', 'filters', 'menu');
58 return $report->render('layout', $result);
59 });
60 }
61 }
62
63 ?>
Something went wrong with that request. Please try again.