From 1b583e9a6565df1aed991d85a2281efa51c30949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20H=C5=AFla?= Date: Thu, 19 May 2016 07:57:35 +0200 Subject: [PATCH] CliTester: pass Environment::COVERAGE locally by Runner [Ref #241] --- src/Runner/CliTester.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Runner/CliTester.php b/src/Runner/CliTester.php index ba7c975c..11e63865 100644 --- a/src/Runner/CliTester.php +++ b/src/Runner/CliTester.php @@ -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(); @@ -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); } @@ -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; }