mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT: Added -v / --verbose option to dev/tests/*, to make it output every single test name before it starts that test. (from r109104)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112782 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
cf6907931b
commit
cda6638281
@ -6,6 +6,16 @@
|
||||
* @subpackage testing
|
||||
*/
|
||||
class CliTestReporter extends SapphireTestReporter {
|
||||
|
||||
protected $verboseOutput = false;
|
||||
|
||||
/**
|
||||
* If you set this to true, then the output for the test runner will be more verbose, listing
|
||||
* every single test name.
|
||||
*/
|
||||
public function setVerboseOutput($verboseOutput) {
|
||||
$this->verboseOutput = $verboseOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display error bar if it exists
|
||||
@ -50,6 +60,12 @@ class CliTestReporter extends SapphireTestReporter {
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
public function startTest(PHPUnit_Framework_Test $test) {
|
||||
parent::startTest($test);
|
||||
if($this->verboseOutput) echo " - {$this->currentTest['name']}: ";
|
||||
}
|
||||
|
||||
public function endTest( PHPUnit_Framework_Test $test, $time) {
|
||||
// Status indicator, a la PHPUnit
|
||||
@ -63,7 +79,13 @@ class CliTestReporter extends SapphireTestReporter {
|
||||
|
||||
static $colCount = 0;
|
||||
$colCount++;
|
||||
if($colCount % 80 == 0) echo " - $colCount\n";
|
||||
|
||||
// We don't need row breaking for verbose output; each test is on its own line
|
||||
if($this->verboseOutput) {
|
||||
echo "\n";
|
||||
} else {
|
||||
if($colCount % 80 == 0) echo " - $colCount\n";
|
||||
}
|
||||
|
||||
parent::endTest($test, $time);
|
||||
$this->writeTest($this->currentTest);
|
||||
|
@ -266,8 +266,16 @@ class TestRunner extends Controller {
|
||||
restore_error_handler();
|
||||
|
||||
/*, array("reportDirectory" => "/Users/sminnee/phpunit-report")*/
|
||||
if(Director::is_cli()) $reporter = new CliTestReporter();
|
||||
else $reporter = new SapphireTestReporter();
|
||||
if(Director::is_cli()) {
|
||||
$reporter = new CliTestReporter();
|
||||
// sake dev/tests/all --verbose will give you better output
|
||||
if(isset($_GET['args']) && (in_array('-v', $_GET['args']) || in_array('--verbose', $_GET['args']))) {
|
||||
$reporter->setVerboseOutput(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
$reporter = new SapphireTestReporter();
|
||||
}
|
||||
|
||||
self::$default_reporter->writeHeader("Sapphire Test Runner");
|
||||
if (count($classList) > 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user