1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Restore hook configuration in lint unit tests. Make working copy setup an

external.

Summary:

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-02-16 11:53:34 -08:00
parent 2f37912946
commit 2354d544e3
3 changed files with 14 additions and 9 deletions

View 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);
}
}

View file

@ -18,17 +18,15 @@
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);

View 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);
}
}