test/php: add colorized testdox output for verbose

This shows all tests as a cute summary and marks failed and good ones
red and green.
This commit is contained in:
Thomas Gelf 2014-11-12 09:15:04 +01:00
parent e5ac319cbb
commit 1cf32dd01d
1 changed files with 18 additions and 2 deletions

View File

@ -56,7 +56,7 @@ class PhpCommand extends Command
$options = array();
if ($this->isVerbose) {
$options[] = '--verbose';
$options[] = '--verbose --testdox';
}
if ($build) {
$reportPath = $this->setupAndReturnReportDirectory();
@ -71,7 +71,23 @@ class PhpCommand extends Command
}
chdir(realpath(__DIR__ . '/../..'));
passthru($phpUnit . ' ' . join(' ', array_merge($options, $this->params->getAllStandalone())));
$command = $phpUnit . ' ' . join(' ', array_merge($options, $this->params->getAllStandalone()));
if ($this->isVerbose) {
$res = `$command`;
foreach (preg_split('/\n/', $res) as $line) {
if (preg_match('~\s+\[([x\s])\]\s~', $line, $m)) {
if ($m[1] === 'x') {
echo $this->screen->colorize($line, 'green') . "\n";
} else {
echo $this->screen->colorize($line, 'red') . "\n";
}
} else {
echo $line . "\n";
}
}
} else {
passthru($command);
}
}
/**