Skip to content

Commit

Permalink
First step to --verbose support in the TextUI test runner.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Aug 15, 2006
1 parent 8aaeebc commit 8486cc9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
36 changes: 33 additions & 3 deletions PHPUnit/TextUI/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,48 @@ class PHPUnit_TextUI_ResultPrinter extends PHPUnit_Util_Printer implements PHPUn
*/
private $lastTestFailed = FALSE;

/**
* @var boolean
* @access private
*/
private $verbose = FALSE;

/**
* Constructor.
*
* @param mixed $out
* @param boolean $verbose
* @throws InvalidArgumentException
* @access public
* @since Method available since Release 3.0.0
*/
public function __construct($out = NULL, $verbose = FALSE)
{
parent::__construct($out);

if (is_bool($verbose)) {
$this->verbose = $verbose;
} else {
throw new InvalidArgumentException;
}
}

/**
* @param PHPUnit_Framework_TestResult $result
* @param float $timeElapsed
* @param float $timeElapsed
* @access public
*/
public function printResult(PHPUnit_Framework_TestResult $result, $timeElapsed)
{
$this->printHeader($timeElapsed);
$this->printErrors($result);
$this->printFailures($result);
$this->printIncompletes($result);
$this->printSkipped($result);

if ($this->verbose) {
$this->printIncompletes($result);
$this->printSkipped($result);
}

$this->printFooter($result);
}

Expand Down
18 changes: 11 additions & 7 deletions PHPUnit/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ protected function start(Array $arguments)
'skeleton',
'testdox-html=',
'testdox-text=',
'verbose',
'version',
'wait'
);
Expand Down Expand Up @@ -269,6 +270,11 @@ protected function start(Array $arguments)
}
break;

case '--verbose': {
$parameters['verbose'] = TRUE;
}
break;

case '--version': {
self::printVersionString();
exit(self::SUCCESS_EXIT);
Expand All @@ -292,10 +298,6 @@ protected function start(Array $arguments)
$this->handleLoader($loaderName);
}

if (!isset($parameters['printer'])) {
$printer = new PHPUnit_TextUI_ResultPrinter;
}

$test = $this->getTest($test, $testFile);

if ($repeat !== FALSE) {
Expand Down Expand Up @@ -375,8 +377,9 @@ protected function createTestResult()
*/
public function doRun(PHPUnit_Framework_Test $suite, Array $parameters = array())
{
$parameters['filter'] = isset($parameters['filter']) ? $parameters['filter'] : FALSE;
$parameters['wait'] = isset($parameters['wait']) ? $parameters['wait'] : FALSE;
$parameters['filter'] = isset($parameters['filter']) ? $parameters['filter'] : FALSE;
$parameters['verbose'] = isset($parameters['verbose']) ? $parameters['verbose'] : FALSE;
$parameters['wait'] = isset($parameters['wait']) ? $parameters['wait'] : FALSE;

if (isset($parameters['graphvizDirectory'])) {
$parameters['graphvizDirectory'] = $this->getDirectory($parameters['graphvizDirectory']);
Expand All @@ -392,7 +395,7 @@ public function doRun(PHPUnit_Framework_Test $suite, Array $parameters = array()
if (isset($parameters['printer']) && $parameters instanceof PHPUnit_Util_Printer) {
$this->printer = $parameters['printer'];
} else {
$this->printer = new PHPUnit_TextUI_ResultPrinter;
$this->printer = new PHPUnit_TextUI_ResultPrinter(NULL, $parameters['verbose']);
}
}

Expand Down Expand Up @@ -530,6 +533,7 @@ public function showHelp()
" --wait Waits for a keystroke after each test.\n\n" .
" --help Prints this usage information.\n" .
" --version Prints the version and exits.\n\n" .
" --verbose Output more verbose information.\n\n" .
" -d key[=value] Sets a php.ini value.\n";
}

Expand Down

0 comments on commit 8486cc9

Please sign in to comment.