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}.
|
|
|
|
*/
|
2015-01-05 06:44:49 +11:00
|
|
|
final class ArcanistUnitTestableLintEngine extends ArcanistLintEngine {
|
2011-01-09 15:22:25 -08:00
|
|
|
|
|
|
|
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) {
|
2015-01-13 06:42:09 +11:00
|
|
|
if (idx($this->fileData, $path) !== null) {
|
2013-08-29 09:55:30 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return parent::pathExists($path);
|
|
|
|
}
|
|
|
|
|
2015-01-07 07:35:20 +11:00
|
|
|
public function buildLinters() {
|
2011-01-09 15:22:25 -08:00
|
|
|
return $this->linters;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|