Skip to content

Commit

Permalink
Adding general OK/FAIL to end of test run.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuswilms committed May 23, 2012
1 parent 5d8113e commit 7b7eebc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion console/command/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ protected function _init() {
}

$report = $runner(compact('reporter'));

$command->out(null, 2);

$command->out($report->render('stats', $report->stats()));

foreach ($report->filters() as $filter => $options) {
Expand Down
23 changes: 15 additions & 8 deletions test/templates/stats.txt.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,35 @@
$fails = intval($count['fails']) ?: 0;
$exceptions = intval($count['exceptions']) ?: 0;

echo "\n" . ($success ? '{:success}' : '') . "{$passes} / {$asserts} passes\n";
if ($success) {
echo "{:green}OK{:end}\n";
} else {
echo "{:red}FAIL{:end}\n";
}
echo "\n";

echo "{$passes} / {$asserts} passes\n";
echo "{$fails} " . ($fails == 1 ? 'fail' : 'fails');
echo " and {$exceptions} ";
echo ($exceptions == 1 ? 'exception' : 'exceptions') . ($success ? '{:end}' : '') . "\n";
echo ($exceptions == 1 ? 'exception' : 'exceptions') . "\n";

foreach ((array) $stats['errors'] as $error) {
if ($error['result'] == 'fail') {
echo "\n{:error}Assertion `{$error['assertion']}` failed in ";
echo "\nAssertion `{$error['assertion']}` failed in ";
echo "`{$error['class']}::{$error['method']}()` on line ";
echo "{$error['line']}:{:end}\n{$error['message']}";
echo "{$error['line']}:\n{$error['message']}";
} elseif ($error['result'] == 'exception') {
echo "{:error}Exception thrown in `{$error['class']}::{$error['method']}()` ";
echo "on line {$error['line']}:{:end}\n{$error['message']}";
echo "Exception thrown in `{$error['class']}::{$error['method']}()` ";
echo "on line {$error['line']}:\n{$error['message']}";
if (isset($error['trace']) && !empty($error['trace'])) {
echo "Trace: {$error['trace']}\n";
}
}
}
foreach ((array) $stats['skips'] as $skip) {
$trace = $skip['trace'][1];
echo "{:cyan}Skip `{$trace['class']}::{$trace['function']}()` ";
echo "on line {$trace['line']}:{:end}\n";
echo "Skip `{$trace['class']}::{$trace['function']}()` ";
echo "on line {$trace['line']}:\n";
echo "{$skip['message']}\n";
}

Expand Down

0 comments on commit 7b7eebc

Please sign in to comment.