Differential D20988 Diff 50015 src/lint/linter/xhpast/rules/__tests__/ArcanistXHPASTLinterRuleTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/__tests__/ArcanistXHPASTLinterRuleTestCase.php
| Show All 23 Lines | abstract class ArcanistXHPASTLinterRuleTestCase | ||||
| } | } | ||||
| /** | /** | ||||
| * Returns an instance of the linter rule being tested. | * Returns an instance of the linter rule being tested. | ||||
| * | * | ||||
| * @return ArcanistXHPASTLinterRule | * @return ArcanistXHPASTLinterRule | ||||
| */ | */ | ||||
| protected function getLinterRule() { | protected function getLinterRule() { | ||||
| $this->assertExecutable('xhpast'); | |||||
| $class = get_class($this); | $class = get_class($this); | ||||
| $matches = null; | $matches = null; | ||||
| if (!preg_match('/^(\w+XHPASTLinterRule)TestCase$/', $class, $matches) || | if (!preg_match('/^(\w+XHPASTLinterRule)TestCase$/', $class, $matches) || | ||||
| !is_subclass_of($matches[1], 'ArcanistXHPASTLinterRule')) { | !is_subclass_of($matches[1], 'ArcanistXHPASTLinterRule')) { | ||||
| throw new Exception(pht('Unable to infer linter rule class name.')); | throw new Exception(pht('Unable to infer linter rule class name.')); | ||||
| } | } | ||||
| return newv($matches[1], array()); | return newv($matches[1], array()); | ||||
| } | } | ||||
| } | } | ||||