Skip to content

Commit

Permalink
CliTester: pass Environment::COVERAGE locally by Runner [Ref #241]
Browse files Browse the repository at this point in the history
  • Loading branch information
milo committed May 19, 2016
1 parent a1e696b commit 1b583e9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Runner/CliTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public function run()
$runner = $this->createRunner();
$runner->setEnvironmentVariable(Environment::RUNNER, 1);
$runner->setEnvironmentVariable(Environment::COLORS, (int) Environment::$useColors);
if (isset($coverageFile)) {
$runner->setEnvironmentVariable(Environment::COVERAGE, $coverageFile);
}

if ($this->options['-o'] !== NULL) {
ob_clean();
Expand All @@ -74,7 +77,7 @@ public function run()

$result = $runner->run();

if (isset($coverageFile)) {
if (isset($coverageFile) && preg_match('#\.(?:html?|xml)\z#', $coverageFile)) {
$this->finishCodeCoverage($coverageFile);
}

Expand Down Expand Up @@ -214,11 +217,8 @@ private function prepareCodeCoverage()
}
file_put_contents($this->options['--coverage'], '');
$file = realpath($this->options['--coverage']);
putenv(Environment::COVERAGE . '=' . $file);
echo "Code coverage: {$file}\n";
if (preg_match('#\.(?:html?|xml)\z#', $file)) {
return $file;
}
return $file;
}


Expand Down

0 comments on commit 1b583e9

Please sign in to comment.