Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistWorkflow.php
| Show First 20 Lines • Show All 1,872 Lines • ▼ Show 20 Lines | protected function newLintEngine($engine_class = null) { | ||||
| $engine = newv($engine_class, array()) | $engine = newv($engine_class, array()) | ||||
| ->setWorkingCopy($working_copy) | ->setWorkingCopy($working_copy) | ||||
| ->setConfigurationManager($config); | ->setConfigurationManager($config); | ||||
| return $engine; | return $engine; | ||||
| } | } | ||||
| /** | |||||
| * Build a new unit test engine for the current working copy. | |||||
| * | |||||
| * Optionally, you can pass an explicit engine class name to build an engine | |||||
| * of a particular class. Normally this is used to implement an `--engine` | |||||
| * flag from the CLI. | |||||
| * | |||||
| * @param string Optional explicit engine class name. | |||||
| * @return ArcanistUnitTestEngine Constructed engine. | |||||
| */ | |||||
| protected function newUnitTestEngine($engine_class = null) { | |||||
| $working_copy = $this->getWorkingCopy(); | |||||
| $config = $this->getConfigurationManager(); | |||||
| if (!$engine_class) { | |||||
| $engine_class = $config->getConfigFromAnySource('unit.engine'); | |||||
| } | |||||
| if (!$engine_class) { | |||||
| if (Filesystem::pathExists($working_copy->getProjectPath('.arcunit'))) { | |||||
| $engine_class = 'ArcanistConfigurationDrivenUnitTestEngine'; | |||||
| } | |||||
| } | |||||
| if (!$engine_class) { | |||||
| throw new ArcanistNoEngineException( | |||||
| pht( | |||||
| "No unit test engine is configured for this project. Create an ". | |||||
| "'%s' file, or configure an advanced engine with '%s' in '%s'.", | |||||
| '.arcunit', | |||||
| 'unit.engine', | |||||
| '.arcconfig')); | |||||
| } | |||||
| $base_class = 'ArcanistUnitTestEngine'; | |||||
| if (!class_exists($engine_class) || | |||||
| !is_subclass_of($engine_class, $base_class)) { | |||||
| throw new ArcanistUsageException( | |||||
| pht( | |||||
| 'Configured unit test engine "%s" is not a subclass of "%s", '. | |||||
epriestley: "lint" -> "unit" | |||||
| 'but must be.', | |||||
| $engine_class, | |||||
| $base_class)); | |||||
| } | |||||
| $engine = newv($engine_class, array()) | |||||
| ->setWorkingCopy($working_copy) | |||||
| ->setConfigurationManager($config); | |||||
| return $engine; | |||||
| } | |||||
| protected function openURIsInBrowser(array $uris) { | protected function openURIsInBrowser(array $uris) { | ||||
| $browser = $this->getBrowserCommand(); | $browser = $this->getBrowserCommand(); | ||||
| foreach ($uris as $uri) { | foreach ($uris as $uri) { | ||||
| $err = phutil_passthru('%s %s', $browser, $uri); | $err = phutil_passthru('%s %s', $browser, $uri); | ||||
| if ($err) { | if ($err) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht( | pht( | ||||
| "Failed to open '%s' in browser ('%s'). ". | "Failed to open '%s' in browser ('%s'). ". | ||||
| ▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines | |||||
"lint" -> "unit"