mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
0bdc8fad81
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60581 467b73ca-7a2a-4603-9d3b-597d59a354a9
40 lines
996 B
PHP
40 lines
996 B
PHP
<?php
|
|
|
|
/**
|
|
* Test reporter optimised for CLI (ie, plain-text) output
|
|
*/
|
|
class CliTestReporter extends SapphireTestReporter {
|
|
|
|
/**
|
|
* Display error bar if it exists
|
|
*/
|
|
public function writeResults() {
|
|
$passCount = 0;
|
|
$failCount = 0;
|
|
$testCount = 0;
|
|
$errorCount = 0;
|
|
|
|
foreach($this->suiteResults['suites'] as $suite) {
|
|
foreach($suite['tests'] as $test) {
|
|
$testCount++;
|
|
($test['status'] == 1) ? $passCount++ : $failCount++;
|
|
}
|
|
}
|
|
$result = ($failCount > 0) ? 'fail' : 'pass';
|
|
echo "$testCount tests run: $passCount passes, $failCount fails, and 0 exceptions\n\n";
|
|
}
|
|
|
|
public function endTest( PHPUnit_Framework_Test $test, $time) {
|
|
parent::endTest($test, $time);
|
|
$this->writeTest($this->currentTest);
|
|
}
|
|
|
|
|
|
protected function writeTest($test) {
|
|
if ($test['status'] != 1) {
|
|
echo $this->testNameToPhrase($test['name']) . "\n". $test['message'] . "\n";
|
|
echo "In line {$test['exception']['line']} of {$test['exception']['file']}" . "\n\n";
|
|
}
|
|
}
|
|
|
|
} |