Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistUnitWorkflow.php
| Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | public function requiresRepositoryAPI() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function getEngine() { | public function getEngine() { | ||||
| return $this->engine; | return $this->engine; | ||||
| } | } | ||||
| public function run() { | public function run() { | ||||
| $working_copy = $this->getWorkingCopy(); | $working_copy = $this->getWorkingCopy(); | ||||
| $engine_class = $this->getArgument( | |||||
| 'engine', | |||||
| $this->getConfigurationManager()->getConfigFromAnySource('unit.engine')); | |||||
| if (!$engine_class) { | |||||
| throw new ArcanistNoEngineException( | |||||
| pht( | |||||
| 'No unit test engine is configured for this project. Edit %s '. | |||||
| 'to specify a unit test engine.', | |||||
| '.arcconfig')); | |||||
| } | |||||
| $paths = $this->getArgument('paths'); | $paths = $this->getArgument('paths'); | ||||
| $rev = $this->getArgument('rev'); | $rev = $this->getArgument('rev'); | ||||
| $everything = $this->getArgument('everything'); | $everything = $this->getArgument('everything'); | ||||
| if ($everything && $paths) { | if ($everything && $paths) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht( | pht( | ||||
| 'You can not specify paths with %s. The %s flag runs every test.', | 'You can not specify paths with %s. The %s flag runs every test.', | ||||
| '--everything', | '--everything', | ||||
| '--everything')); | '--everything')); | ||||
| } | } | ||||
| if ($everything) { | if ($everything) { | ||||
| $paths = iterator_to_array($this->getRepositoryApi()->getAllFiles()); | $paths = iterator_to_array($this->getRepositoryApi()->getAllFiles()); | ||||
| } else { | } else { | ||||
| $paths = $this->selectPathsForWorkflow($paths, $rev); | $paths = $this->selectPathsForWorkflow($paths, $rev); | ||||
| } | } | ||||
| if (!class_exists($engine_class) || | $this->engine = $this->newUnitTestEngine($this->getArgument('engine')); | ||||
| !is_subclass_of($engine_class, 'ArcanistUnitTestEngine')) { | |||||
| throw new ArcanistUsageException( | |||||
| pht( | |||||
| "Configured unit test engine '%s' is not a subclass of '%s'.", | |||||
| $engine_class, | |||||
| 'ArcanistUnitTestEngine')); | |||||
| } | |||||
| $this->engine = newv($engine_class, array()); | |||||
| $this->engine->setWorkingCopy($working_copy); | |||||
| $this->engine->setConfigurationManager($this->getConfigurationManager()); | |||||
| if ($everything) { | if ($everything) { | ||||
| $this->engine->setRunAllTests(true); | $this->engine->setRunAllTests(true); | ||||
| } else { | } else { | ||||
| $this->engine->setPaths($paths); | $this->engine->setPaths($paths); | ||||
| } | } | ||||
| $this->engine->setArguments($this->getPassthruArgumentsAsMap('unit')); | $this->engine->setArguments($this->getPassthruArgumentsAsMap('unit')); | ||||
| $renderer = new ArcanistUnitConsoleRenderer(); | $renderer = new ArcanistUnitConsoleRenderer(); | ||||
| ▲ Show 20 Lines • Show All 245 Lines • Show Last 20 Lines | |||||