<?php
-abstract class ArcanistTestCase extends ArcanistPhutilTestCase {
-
- protected function getLink($method) {
- $arcanist_project = 'PHID-APRJ-703e0b140530f17ede30';
- return
- 'https://secure.phabricator.com/diffusion/symbol/'.$method.
- '/?lang=php&projects='.$arcanist_project.
- '&jump=true&context='.get_class($this);
- }
-
-}
+abstract class ArcanistTestCase extends ArcanistPhutilTestCase {}
private $results = array();
private $enableCoverage;
private $coverage = array();
- private $projectRoot;
+ private $workingCopy;
private $paths;
private $renderer;
$coverage = array();
foreach ($result as $file => $report) {
- if (strncmp($file, $this->projectRoot, strlen($this->projectRoot))) {
+ $project_root = $this->getProjectRoot();
+
+ if (strncmp($file, $project_root, strlen($project_root))) {
continue;
}
$str .= 'N'; // Not executable.
}
}
- $coverage[substr($file, strlen($this->projectRoot) + 1)] = $str;
+ $coverage[substr($file, strlen($project_root) + 1)] = $str;
}
// Only keep coverage information for files modified by the change. In
}
}
- final public function setProjectRoot($project_root) {
- $this->projectRoot = $project_root;
+ final public function getWorkingCopy() {
+ return $this->workingCopy;
+ }
+
+ final public function setWorkingCopy(
+ ArcanistWorkingCopyIdentity $working_copy) {
+
+ $this->workingCopy = $working_copy;
return $this;
}
+ final public function getProjectRoot() {
+ $working_copy = $this->getWorkingCopy();
+
+ if (!$working_copy) {
+ throw new PhutilInvalidStateException('setWorkingCopy');
+ }
+
+ return $working_copy->getProjectRoot();
+ }
+
final public function setPaths(array $paths) {
$this->paths = $paths;
return $this;
}
- protected function getLink($method) {
- return null;
+ final protected function getLink($method) {
+ $base_uri = $this
+ ->getWorkingCopy()
+ ->getProjectConfig('phabricator.uri');
+
+ $uri = id(new PhutilURI($base_uri))
+ ->setPath("/diffusion/symbol/{$method}/")
+ ->setQueryParam('context', get_class($this))
+ ->setQueryParam('jump', 'true')
+ ->setQueryParam('lang', 'php');
+
+ return (string)$uri;
}
public function setRenderer(ArcanistUnitRenderer $renderer) {