]> khamidou — GitHub mirrors - arcanist.git/commitdiff
get Config Manager to Unit engine and use getConfigFromAnySource
authorAviv Eyal <avivey@gmail.com>
Tue, 22 Oct 2013 20:58:32 +0000 (13:58 -0700)
committerepriestley <git@epriestley.com>
Tue, 22 Oct 2013 20:58:32 +0000 (13:58 -0700)
Summary:
somewhat related to D7271 and D7377.
Not actually broken right now, but might be worth it for completeness.

Test Plan: arc unit invokes PHPUnit; Can't test Csharp/XUnit on my end.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: aurelijus, Korvin, epriestley, aran
Differential Revision: https://secure.phabricator.com/D7381

src/unit/engine/ArcanistBaseUnitTestEngine.php
src/unit/engine/CSharpToolsTestEngine.php
src/unit/engine/PhpunitTestEngine.php
src/unit/engine/XUnitTestEngine.php
src/workflow/ArcanistUnitWorkflow.php

index 802cc15d17cb39b92a43439e6ff5327425601c0c..9f3ae5e2915c0613b85ccaebe0c9f41c4a49dc08 100644 (file)
@@ -40,6 +40,16 @@ abstract class ArcanistBaseUnitTestEngine {
 
   }
 
+  public function setConfigurationManager(
+    ArcanistConfigurationManager $configuration_manager) {
+    $this->configurationManager = $configuration_manager;
+    return $this;
+  }
+
+  public function getConfigurationManager() {
+    return $this->configurationManager;
+  }
+
   final public function setWorkingCopy(
     ArcanistWorkingCopyIdentity $working_copy) {
 
index c4de29b5c118e3aa80883da1671070d19d56c956..0336979847bfc0565d5ed4f9fb75d7ae6f142c9f 100644 (file)
@@ -26,11 +26,15 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
   protected function loadEnvironment(
     $config_item = 'unit.csharp.xunit.binary') {
 
-    $working = $this->getWorkingCopy();
-    $this->xunitHintPath = $working->getConfig('unit.csharp.xunit.binary');
-    $this->cscoverHintPath = $working->getConfig('unit.csharp.cscover.binary');
-    $this->matchRegex = $working->getConfig('unit.csharp.coverage.match');
-    $this->excludedFiles = $working->getConfig('unit.csharp.coverage.excluded');
+    $config = $this->getConfigurationManager();
+    $this->xunitHintPath =
+      $config->getConfigFromAnySource('unit.csharp.xunit.binary');
+    $this->cscoverHintPath =
+      $config->getConfigFromAnySource('unit.csharp.cscover.binary');
+    $this->matchRegex =
+      $config->getConfigFromAnySource('unit.csharp.coverage.match');
+    $this->excludedFiles =
+      $config->getConfigFromAnySource('unit.csharp.coverage.excluded');
 
     parent::loadEnvironment($config_item);
 
index 55be1e8e0560838f5c2e1d24ad33aba321539d83..4a29af6606afcaa04e75cc7becdc22210c3e18f3 100644 (file)
@@ -257,8 +257,10 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
    */
   private function prepareConfigFile() {
     $project_root = $this->projectRoot . DIRECTORY_SEPARATOR;
+    $config = $this->getConfigurationManager()->getConfigFromAnySource(
+      'phpunit_config');
 
-    if ($config = $this->getWorkingCopy()->getConfig('phpunit_config')) {
+    if ($config) {
       if (Filesystem::pathExists($project_root . $config)) {
         $this->configFile = $project_root . $config;
       } else {
@@ -266,7 +268,9 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
           'found in ' . $project_root . $config);
       }
     }
-    if ($bin = $this->getWorkingCopy()->getConfig('unit.phpunit.binary')) {
+    $bin = $this->getConfigurationManager()->getConfigFromAnySource(
+      'unit.phpunit.binary');
+    if ($bin) {
       if (Filesystem::binaryExists($bin)) {
         $this->phpunitBinary = $bin;
       }
index 79887f5b955e7370e614fb58ee96b8dcbedba2db..e2cd105a8a2ea2c6ff26ff6deb48269c42e5b4a4 100644 (file)
@@ -56,8 +56,9 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
 
     // Determine xUnit test runner path.
     if ($this->xunitHintPath === null) {
-      $this->xunitHintPath = $this->getWorkingCopy()->getConfig(
-        'unit.xunit.binary');
+      $this->xunitHintPath =
+        $this->getConfigurationManager()->getConfigFromAnySource(
+          'unit.xunit.binary');
     }
     if ($this->xunitHintPath === null) {
     }
index 64e7fc199dbe9e46821e33866df63313ed7aa148..cbf99ce405730feab91fce1bee578d389aabe688 100644 (file)
@@ -143,6 +143,7 @@ EOTEXT
 
     $this->engine = newv($engine_class, array());
     $this->engine->setWorkingCopy($working_copy);
+    $this->engine->setConfigurationManager($this->getConfigurationManager());
     if ($everything) {
       $this->engine->setRunAllTests(true);
     } else {