2011-01-09 15:22:25 -08:00
|
|
|
<?php
|
|
|
|
|
2011-02-19 11:36:08 -08:00
|
|
|
/**
|
|
|
|
* Lint engine for use in constructing test cases. See
|
|
|
|
* @{class:ArcanistLinterTestCase}.
|
|
|
|
*/
|
2011-01-09 15:22:25 -08:00
|
|
|
final class UnitTestableArcanistLintEngine extends ArcanistLintEngine {
|
|
|
|
|
|
|
|
protected $linters = array();
|
|
|
|
|
|
|
|
public function addLinter($linter) {
|
|
|
|
$this->linters[] = $linter;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addFileData($path, $data) {
|
|
|
|
$this->fileData[$path] = $data;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-08-29 09:55:30 -07:00
|
|
|
public function pathExists($path) {
|
|
|
|
if (idx($this->fileData, $path)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return parent::pathExists($path);
|
|
|
|
}
|
|
|
|
|
2011-01-09 15:22:25 -08:00
|
|
|
protected function buildLinters() {
|
|
|
|
return $this->linters;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|