Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/ArcanistCSharpToolsTestEngine.php
- This file was copied from src/unit/engine/CSharpToolsTestEngine.php.
<?php | <?php | ||||
/** | /** | ||||
* Uses cscover (http://github.com/hach-que/cstools) to report code coverage. | * Uses cscover (http://github.com/hach-que/cstools) to report code coverage. | ||||
* | * | ||||
* This engine inherits from `XUnitTestEngine`, where xUnit is used to actually | * This engine inherits from @{class:ArcanistXUnitTestEngine}, where xUnit is | ||||
* run the unit tests and this class provides a thin layer on top to collect | * used to actually run the unit tests and this class provides a thin layer on | ||||
* code coverage data with a third-party tool. | * top to collect code coverage data with a third-party tool. | ||||
* | |||||
* @todo Should be final but isn't because of @{class:CSharpToolsTestEngine}. | |||||
*/ | */ | ||||
final class CSharpToolsTestEngine extends XUnitTestEngine { | class ArcanistCSharpToolsTestEngine extends ArcanistXUnitTestEngine { | ||||
private $cscoverHintPath; | private $cscoverHintPath; | ||||
private $coverEngine; | private $coverEngine; | ||||
private $cachedResults; | private $cachedResults; | ||||
private $matchRegex; | private $matchRegex; | ||||
private $excludedFiles; | private $excludedFiles; | ||||
/** | /** | ||||
Show All 13 Lines | protected function loadEnvironment() { | ||||
if ($this->getEnableCoverage() === false) { | if ($this->getEnableCoverage() === false) { | ||||
return; | return; | ||||
} | } | ||||
// Determine coverage path. | // Determine coverage path. | ||||
if ($this->cscoverHintPath === null) { | if ($this->cscoverHintPath === null) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | "Unable to locate cscover. Configure it with ". | ||||
"Unable to locate %s. Configure it with the '%s' option in %s.", | "the `unit.csharp.coverage.binary' option in .arcconfig"); | ||||
'cscover', | |||||
'unit.csharp.coverage.binary', | |||||
'.arcconfig')); | |||||
} | } | ||||
$cscover = $this->projectRoot.DIRECTORY_SEPARATOR.$this->cscoverHintPath; | $cscover = $this->projectRoot.DIRECTORY_SEPARATOR.$this->cscoverHintPath; | ||||
if (file_exists($cscover)) { | if (file_exists($cscover)) { | ||||
$this->coverEngine = Filesystem::resolvePath($cscover); | $this->coverEngine = Filesystem::resolvePath($cscover); | ||||
} else { | } else { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | 'Unable to locate cscover coverage runner (have you built yet?)'); | ||||
'Unable to locate %s coverage runner (have you built yet?)', | |||||
'cscover')); | |||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Returns whether the specified assembly should be instrumented for | * Returns whether the specified assembly should be instrumented for | ||||
* code coverage reporting. Checks the excluded file list and the | * code coverage reporting. Checks the excluded file list and the | ||||
* matching regex if they are configured. | * matching regex if they are configured. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 226 Lines • Show Last 20 Lines |