Skip to content

Commit 20198c1

Browse files
committed
CliTester: pass Environment::COVERAGE locally by Runner [Ref #241]
1 parent ee61e4f commit 20198c1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Runner/CliTester.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function run()
6161
$runner = $this->createRunner();
6262
$runner->setEnvironmentVariable(Environment::RUNNER, 1);
6363
$runner->setEnvironmentVariable(Environment::COLORS, (int) Environment::$useColors);
64+
if (isset($coverageFile)) {
65+
$runner->setEnvironmentVariable(Environment::COVERAGE, $coverageFile);
66+
}
6467

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

7578
$result = $runner->run();
7679

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

@@ -214,11 +217,8 @@ private function prepareCodeCoverage()
214217
}
215218
file_put_contents($this->options['--coverage'], '');
216219
$file = realpath($this->options['--coverage']);
217-
putenv(Environment::COVERAGE . '=' . $file);
218220
echo "Code coverage: {$file}\n";
219-
if (preg_match('#\.(?:html?|xml)\z#', $file)) {
220-
return $file;
221-
}
221+
return $file;
222222
}
223223

224224

0 commit comments

Comments
 (0)