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);
}
}
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) {
$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);
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);
}
}