]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Restore hook configuration in lint unit tests. Make working copy setup an
authorepriestley <epriestley@javelinjs.com>
Wed, 16 Feb 2011 19:53:34 +0000 (11:53 -0800)
committerepriestley <epriestley@javelinjs.com>
Wed, 16 Feb 2011 19:53:34 +0000 (11:53 -0800)
external.

Summary:

Test Plan:

Reviewers:

CC:

src/lint/linter/apachelicense/__tests__/ArcanistApacheLicenseLinterTestCase.php
src/lint/linter/base/test/ArcanistLinterTestCase.php
src/lint/linter/xhpast/__tests__/ArcanistXHPASTLinterTestCase.php

index b06c3ec170bee097d773889c968b89ed4dc41bd4..96643aeaa9dad5ac0c2d03ee2ab117f4e65cad0a 100644 (file)
@@ -20,7 +20,11 @@ class ArcanistApacheLicenseLinterTestCase extends ArcanistLinterTestCase {
 
   public function testApacheLicenseLint() {
     $linter = new ArcanistApacheLicenseLinter();
-    return $this->executeTestsInDirectory(dirname(__FILE__).'/data/', $linter);
+    $working_copy = ArcanistWorkingCopyIdentity::newFromPath(__FILE__);
+    return $this->executeTestsInDirectory(
+      dirname(__FILE__).'/data/',
+      $linter,
+      $working_copy);
   }
 
 }
index 10d6a291a7d5e743e6ba263a831f86ddd9fd47d8..8b02bdf1ceac4f9e08262d4b5ab4d73e9a92e4e9 100644 (file)
 
 abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
 
-  public function executeTestsInDirectory($root, $linter) {
+  public function executeTestsInDirectory($root, $linter, $working_copy) {
     foreach (Filesystem::listDirectory($root, $hidden = false) as $file) {
-      $this->lintFile($root.$file, $linter);
+      $this->lintFile($root.$file, $linter, $working_copy);
     }
   }
 
-  private function lintFile($file, $linter) {
+  private function lintFile($file, $linter, $working_copy) {
     $linter = clone $linter;
 
-    $working_copy = ArcanistWorkingCopyIdentity::newFromPath(__FILE__);
-
     $contents = Filesystem::readFile($file);
     $contents = explode("~~~~~~~~~~\n", $contents);
     if (count($contents) < 2) {
@@ -77,8 +75,7 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
       $engine->setWorkingCopy($working_copy);
       $engine->setPaths(array($path));
 
-//  TODO: restore this
-//      $engine->setCommitHookMode(idx($config, 'hook', false));
+      $engine->setCommitHookMode(idx($config, 'hook', false));
 
       $linter->addPath($path);
       $linter->addData($path, $data);
index e04eec3b1204d0268f63e340dd8ff45616c565aa..ccc71831299da728633f4793a782ecb23eb4e6ab 100644 (file)
@@ -20,7 +20,11 @@ class ArcanistXHPASTLinterTestCase extends ArcanistLinterTestCase {
 
   public function testXHPASTLint() {
     $linter = new ArcanistXHPASTLinter();
-    return $this->executeTestsInDirectory(dirname(__FILE__).'/data/', $linter);
+    $working_copy = ArcanistWorkingCopyIdentity::newFromPath(__FILE__);
+    return $this->executeTestsInDirectory(
+      dirname(__FILE__).'/data/',
+      $linter,
+      $working_copy);
   }
 
 }