Skip to content

Commit

Permalink
Fix --stderr with --tap or --testdox options
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquemoody committed Dec 19, 2014
1 parent 980444a commit ea1fea3
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/TextUI/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,12 @@ protected function handleArguments(array $argv)
break;

case '--tap': {
$this->arguments['printer'] = new PHPUnit_Util_Log_TAP;
$this->arguments['printer'] = 'PHPUnit_Util_Log_TAP';
}
break;

case '--testdox': {
$this->arguments['printer'] = new PHPUnit_Util_TestDox_ResultPrinter_Text;
$this->arguments['printer'] = 'PHPUnit_Util_TestDox_ResultPrinter_Text';
}
break;

Expand Down Expand Up @@ -604,11 +604,6 @@ protected function handleArguments(array $argv)
);
}

if (isset($this->arguments['printer']) &&
is_string($this->arguments['printer'])) {
$this->arguments['printer'] = $this->handlePrinter($this->arguments['printer']);
}

if ($this->arguments['loader'] !== null) {
$this->arguments['loader'] = $this->handleLoader($this->arguments['loader']);
}
Expand Down Expand Up @@ -664,11 +659,8 @@ protected function handleArguments(array $argv)
/**
* Issue #657
*/
if (isset($phpunit['stderr']) && $phpunit['stderr'] == true) {
$this->arguments['printer'] = new PHPUnit_TextUI_ResultPrinter(
'php://stderr',
isset($this->arguments['verbose']) ? $this->arguments['verbose'] : false
);
if (isset($phpunit['stderr']) && ! isset($this->arguments['stderr'])) {
$this->arguments['stderr'] = $phpunit['stderr'];
}

if (isset($phpunit['printerClass'])) {
Expand Down Expand Up @@ -713,6 +705,11 @@ class_exists('PHPUnit_Extensions_SeleniumTestCase')) {
$this->handleBootstrap($this->arguments['bootstrap']);
}

if (isset($this->arguments['printer']) &&
is_string($this->arguments['printer'])) {
$this->arguments['printer'] = $this->handlePrinter($this->arguments['printer']);
}

if (isset($this->arguments['test']) && is_string($this->arguments['test']) && substr($this->arguments['test'], -5, 5) == '.phpt') {
$test = new PHPUnit_Extensions_PhptTestCase($this->arguments['test']);

Expand Down Expand Up @@ -804,7 +801,9 @@ protected function handlePrinter($printerClass, $printerFile = '')
return $printerClass;
}

return $class->newInstance();
$outputStream = isset($this->arguments['stderr']) ? 'php://stderr' : null;

return $class->newInstance($outputStream);
}
}

Expand Down

0 comments on commit ea1fea3

Please sign in to comment.