Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/__tests__/ArcanistLinterTestCase.php
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | try { | ||||
'Unit Test'); | 'Unit Test'); | ||||
$configuration_manager = new ArcanistConfigurationManager(); | $configuration_manager = new ArcanistConfigurationManager(); | ||||
$configuration_manager->setWorkingCopyIdentity($working_copy); | $configuration_manager->setWorkingCopyIdentity($working_copy); | ||||
$engine = new ArcanistUnitTestableLintEngine(); | $engine = new ArcanistUnitTestableLintEngine(); | ||||
$engine->setWorkingCopy($working_copy); | $engine->setWorkingCopy($working_copy); | ||||
$engine->setConfigurationManager($configuration_manager); | $engine->setConfigurationManager($configuration_manager); | ||||
$engine->setPaths(array($path)); | |||||
$engine->setCommitHookMode(idx($config, 'hook', false)); | $engine->setCommitHookMode(idx($config, 'hook', false)); | ||||
$path_name = idx($config, 'path', $path); | $path_name = idx($config, 'path', $path); | ||||
$engine->setPaths(array($path_name)); | |||||
$linter->addPath($path_name); | $linter->addPath($path_name); | ||||
$linter->addData($path_name, $data); | $linter->addData($path_name, $data); | ||||
foreach (idx($config, 'config', array()) as $key => $value) { | foreach (idx($config, 'config', array()) as $key => $value) { | ||||
$linter->setLinterConfigurationValue($key, $value); | $linter->setLinterConfigurationValue($key, $value); | ||||
} | } | ||||
$engine->addLinter($linter); | $engine->addLinter($linter); | ||||
$engine->addFileData($path_name, $data); | $engine->addFileData($path_name, $data); | ||||
$results = $engine->run(); | $results = $engine->run(); | ||||
$this->assertEqual( | $this->assertEqual( | ||||
1, | 1, | ||||
count($results), | count($results), | ||||
pht('Expect one result returned by linter.')); | pht('Expect one result returned by linter.')); | ||||
$assert_stopped = idx($config, 'stopped'); | $assert_stopped = idx($config, 'stopped'); | ||||
if ($assert_stopped !== null) { | if ($assert_stopped !== null) { | ||||
$this->assertEqual( | $this->assertEqual( | ||||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |