diff --git a/src/unit/engine/base/ArcanistBaseUnitTestEngine.php b/src/unit/engine/base/ArcanistBaseUnitTestEngine.php index a8f5b41d..c3dee67d 100644 --- a/src/unit/engine/base/ArcanistBaseUnitTestEngine.php +++ b/src/unit/engine/base/ArcanistBaseUnitTestEngine.php @@ -26,6 +26,7 @@ abstract class ArcanistBaseUnitTestEngine { private $workingCopy; private $paths; private $arguments = array(); + protected $diffID; final public function __construct() { @@ -62,4 +63,12 @@ abstract class ArcanistBaseUnitTestEngine { abstract public function run(); + /** + * This function is called after run() when the diff is created + * Child classes should override this function if they want to + * do more with the diff ID. + */ + public function setDifferentialDiffID($id) { + $this->diffID = $id; + } } diff --git a/src/workflow/diff/ArcanistDiffWorkflow.php b/src/workflow/diff/ArcanistDiffWorkflow.php index b86ecc73..f21e5f67 100644 --- a/src/workflow/diff/ArcanistDiffWorkflow.php +++ b/src/workflow/diff/ArcanistDiffWorkflow.php @@ -27,6 +27,7 @@ class ArcanistDiffWorkflow extends ArcanistBaseWorkflow { private $unresolvedLint; private $unresolvedTests; private $diffID; + private $unitWorkflow; public function getCommandHelp() { return phutil_console_format(<<unitWorkflow) { + $this->unitWorkflow->setDifferentialDiffID($diff_info['diffid']); + } + if ($this->unresolvedLint) { $data = array(); foreach ($this->unresolvedLint as $message) { @@ -1107,8 +1112,8 @@ EOTEXT if ($repository_api instanceof ArcanistSubversionAPI) { $argv = array_merge($argv, array_keys($paths)); } - $unit_workflow = $this->buildChildWorkflow('unit', $argv); - $unit_result = $unit_workflow->run(); + $this->unitWorkflow = $this->buildChildWorkflow('unit', $argv); + $unit_result = $this->unitWorkflow->run(); switch ($unit_result) { case ArcanistUnitWorkflow::RESULT_OKAY: echo phutil_console_format( @@ -1133,7 +1138,7 @@ EOTEXT break; } - $this->unresolvedTests = $unit_workflow->getUnresolvedTests(); + $this->unresolvedTests = $this->unitWorkflow->getUnresolvedTests(); return $unit_result; } catch (ArcanistNoEngineException $ex) { diff --git a/src/workflow/unit/ArcanistUnitWorkflow.php b/src/workflow/unit/ArcanistUnitWorkflow.php index c706ce9e..0a53487e 100644 --- a/src/workflow/unit/ArcanistUnitWorkflow.php +++ b/src/workflow/unit/ArcanistUnitWorkflow.php @@ -29,6 +29,7 @@ class ArcanistUnitWorkflow extends ArcanistBaseWorkflow { const RESULT_SKIP = 3; private $unresolvedTests; + private $engine; public function getCommandHelp() { return phutil_console_format(<<setWorkingCopy($working_copy); - $engine->setPaths($paths); - $engine->setArguments($this->getPassthruArgumentsAsMap('unit')); + $this->engine = newv($engine_class, array()); + $this->engine->setWorkingCopy($working_copy); + $this->engine->setPaths($paths); + $this->engine->setArguments($this->getPassthruArgumentsAsMap('unit')); - $results = $engine->run(); + $results = $this->engine->run(); $status_codes = array( ArcanistUnitTestResult::RESULT_PASS => phutil_console_format( @@ -156,4 +157,10 @@ EOTEXT return $this->unresolvedTests; } + public function setDifferentialDiffID($id) { + if ($this->engine) { + $this->engine->setDifferentialDiffID($id); + } + } + }