Changeset View
Changeset View
Standalone View
Standalone View
src/unit/overseer/ArcanistUnitOverseer.php
| <?php | <?php | ||||
| final class ArcanistUnitOverseer | final class ArcanistUnitOverseer | ||||
| extends Phobject { | extends Phobject { | ||||
| private $directory; | private $directory; | ||||
| private $paths = array(); | private $paths = array(); | ||||
| private $formatter; | private $sinks = array(); | ||||
| public function setPaths($paths) { | public function setPaths(array $paths) { | ||||
| $this->paths = $paths; | $this->paths = $paths; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getPaths() { | public function getPaths() { | ||||
| return $this->paths; | return $this->paths; | ||||
| } | } | ||||
| public function setFormatter(ArcanistUnitFormatter $formatter) { | public function setSinks(array $sinks) { | ||||
| $this->formatter = $formatter; | assert_instances_of($sinks, 'ArcanistUnitSink'); | ||||
| $this->sinks = $sinks; | |||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getFormatter() { | public function getSinks() { | ||||
| return $this->formatter; | return $this->sinks; | ||||
| } | } | ||||
| public function setDirectory($directory) { | public function setDirectory($directory) { | ||||
| $this->directory = $directory; | $this->directory = $directory; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getDirectory() { | public function getDirectory() { | ||||
| Show All 11 Lines | public function execute() { | ||||
| foreach ($engines as $engine) { | foreach ($engines as $engine) { | ||||
| $tests = $engine->runTests(); | $tests = $engine->runTests(); | ||||
| foreach ($tests as $test) { | foreach ($tests as $test) { | ||||
| $results[] = $test; | $results[] = $test; | ||||
| } | } | ||||
| } | } | ||||
| $this->didCompleteTests($results); | |||||
| return $results; | return $results; | ||||
| } | } | ||||
| public function didRunTests(array $tests) { | |||||
| assert_instances_of($tests, 'ArcanistUnitTestResult'); | |||||
| foreach ($this->getSinks() as $sink) { | |||||
| $sink->sinkPartialResults($tests); | |||||
| } | |||||
| } | |||||
| private function didCompleteTests(array $tests) { | |||||
| assert_instances_of($tests, 'ArcanistUnitTestResult'); | |||||
| foreach ($this->getSinks() as $sink) { | |||||
| $sink->sinkFinalResults($tests); | |||||
| } | |||||
| } | |||||
| private function loadEngines() { | private function loadEngines() { | ||||
| $root = $this->getDirectory(); | $root = $this->getDirectory(); | ||||
| $arcunit_path = Filesystem::concatenatePaths(array($root, '.arcunit')); | $arcunit_path = Filesystem::concatenatePaths(array($root, '.arcunit')); | ||||
| $arcunit_display = Filesystem::readablePath($arcunit_path); | $arcunit_display = Filesystem::readablePath($arcunit_path); | ||||
| if (!Filesystem::pathExists($arcunit_path)) { | if (!Filesystem::pathExists($arcunit_path)) { | ||||
| throw new Exception( | throw new Exception( | ||||
| ▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines | |||||