Permalink
Browse files

Refitting test reporter as progress reporter.

As in the orginal concept as of `Unit::_result()`.
This will allow to progress print after each assertion.
  • Loading branch information...
1 parent 65eddeb commit 266559bc6b36207c15b9a2faee38b534f7a46cec @davidpersson davidpersson committed May 19, 2012
View
6 test/Dispatcher.php
@@ -40,8 +40,8 @@ class Dispatcher extends \lithium\core\StaticObject {
* - `'case'`: The fully namespaced test case to be run.
* - `'group'`: The fully namespaced test group to be run.
* - `'filters'`: An array of filters that the test output should be run through.
- * - `'reporter'`: The reporter to use, defaults to `'console'`.
- * - `'format'`: The format of the reporter template to use, defaults to `'txt'`.
+ * - `'format'`: The format of the template to use, defaults to `'txt'`.
+ * - `'reporter'`: The reporter to use.
* @return array A compact array of the title, an array of the results, as well
* as an additional array of the results after the $options['filters']
* have been applied.
@@ -51,8 +51,8 @@ public static function run($group = null, array $options = array()) {
$defaults = array(
'title' => $group,
'filters' => array(),
- 'reporter' => 'console',
'format' => 'txt',
+ 'reporter' => null,
'progress' => null
);
$options += $defaults;
View
19 test/Report.php
@@ -17,18 +17,17 @@
* obtain the results and stats (passes, fails, exceptions, skips) of the test run.
*
* While Lithium already comes with a text-based as well as web-based test interface, you
- * may use or extend the `Report` class to create your own test reporter functionality. In
+ * may use or extend the `Report` class to create your own test report functionality. In
* addition, you can also create your own custom templates for displaying results in a different
* format, such as json.
*
- * Example usage, for built-in HTML format/reporter:
+ * Example usage, for built-in HTML format:
*
* {{{
* $report = new Report(array(
* 'title' => 'Test Report Title',
* 'group' => new Group(array('data' => array('lithium\tests\cases\net\http\MediaTest'))),
- * 'format' => 'html',
- * 'reporter' => 'html'
+ * 'format' => 'html'
* ));
*
* $report->run();
@@ -105,16 +104,16 @@ class Report extends \lithium\core\Object {
* @param array $config Options array for the test run. Valid options are:
* - `'group'`: The test group with items to be run.
* - `'filters'`: An array of filters that the test output should be run through.
- * - `'reporter'`: The reporter to use, defaults to `'console'`.
- * - `'format'`: The format of the reporter template to use, defaults to `'txt'`.
+ * - `'format'`: The format of the template to use, defaults to `'txt'`.
+ * - `'reporter'`: The reporter to use.
*/
public function __construct(array $config = array()) {
$defaults = array(
'title' => null,
'group' => null,
'filters' => array(),
- 'reporter' => 'console',
'format' => 'txt',
+ 'reporter' => null,
'progress' => null
);
parent::__construct($config + $defaults);
@@ -146,7 +145,9 @@ public function run() {
$this->results['filters'][$filter] = array();
$tests = $filter::apply($this, $tests, $options['apply']) ?: $tests;
}
- $this->results['group'] = $tests->run();
+ $this->results['group'] = $tests->run(array(
+ 'reporter' => $this->_config['reporter']
+ ));
foreach ($this->filters() as $filter => $options) {
$this->results['filters'][$filter] = $filter::analyze($this, $options['analyze']);
@@ -228,7 +229,7 @@ public function render($template, $data = array()) {
if ($template == "stats" && !$data) {
$data = $this->stats();
}
- $template = Libraries::locate("test.templates.{$config['reporter']}", $template, array(
+ $template = Libraries::locate('test.templates', $template, array(
'filter' => false, 'type' => 'file', 'suffix' => ".{$config['format']}.php"
));
$params = compact('template', 'data', 'config');
View
0 test/templates/html/affected.html.php → test/templates/affected.html.php
File renamed without changes.
View
0 test/templates/console/affected.json.php → test/templates/affected.json.php
File renamed without changes.
View
0 test/templates/console/affected.txt.php → test/templates/affected.txt.php
File renamed without changes.
View
0 test/templates/html/complexity.html.php → test/templates/complexity.html.php
File renamed without changes.
View
0 test/templates/console/complexity.json.php → test/templates/complexity.json.php
File renamed without changes.
View
0 test/templates/console/complexity.txt.php → test/templates/complexity.txt.php
File renamed without changes.
View
0 test/templates/html/coverage.html.php → test/templates/coverage.html.php
File renamed without changes.
View
0 test/templates/console/coverage.json.php → test/templates/coverage.json.php
File renamed without changes.
View
0 test/templates/console/coverage.txt.php → test/templates/coverage.txt.php
File renamed without changes.
View
0 test/templates/html/exception.html.php → test/templates/exception.html.php
File renamed without changes.
View
0 test/templates/html/fail.html.php → test/templates/fail.html.php
File renamed without changes.
View
0 test/templates/html/layout.html.php → test/templates/layout.html.php
File renamed without changes.
View
0 test/templates/html/menu.html.php → test/templates/menu.html.php
File renamed without changes.
View
0 test/templates/html/profiler.html.php → test/templates/profiler.html.php
File renamed without changes.
View
0 test/templates/console/profiler.json.php → test/templates/profiler.json.php
File renamed without changes.
View
0 test/templates/console/profiler.txt.php → test/templates/profiler.txt.php
File renamed without changes.
View
0 test/templates/html/stats.html.php → test/templates/stats.html.php
File renamed without changes.
View
0 test/templates/console/stats.json.php → test/templates/stats.json.php
File renamed without changes.
View
0 test/templates/console/stats.txt.php → test/templates/stats.txt.php
File renamed without changes.

0 comments on commit 266559b

Please sign in to comment.