Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15412308
D12664.id30425.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D12664.id30425.diff
View Options
diff --git a/src/infrastructure/testing/ArcanistTestCase.php b/src/infrastructure/testing/ArcanistTestCase.php
--- a/src/infrastructure/testing/ArcanistTestCase.php
+++ b/src/infrastructure/testing/ArcanistTestCase.php
@@ -1,13 +1,3 @@
<?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 {}
diff --git a/src/unit/engine/PhutilUnitTestEngine.php b/src/unit/engine/PhutilUnitTestEngine.php
--- a/src/unit/engine/PhutilUnitTestEngine.php
+++ b/src/unit/engine/PhutilUnitTestEngine.php
@@ -39,7 +39,8 @@
foreach ($run_tests as $test_class) {
$test_case = newv($test_class, array());
$test_case->setEnableCoverage($enable_coverage);
- $test_case->setProjectRoot($project_root);
+ $test_case->setWorkingCopy($this->getWorkingCopy());
+
if ($this->getPaths()) {
$test_case->setPaths($this->getPaths());
}
@@ -71,7 +72,7 @@
$symbols = id(new PhutilSymbolLoader())
->setType('class')
- ->setAncestorClass('ArcanistPhutilTestCase')
+ ->setAncestorClass('PhutilTestCase')
->setConcreteOnly(true)
->selectSymbolsWithoutLoading();
@@ -153,7 +154,7 @@
}
}
- // Look for any class that extends ArcanistPhutilTestCase inside a
+ // Look for any class that extends PhutilTestCase inside a
// __tests__ directory in any parent directory of every affected file.
//
// The idea is that "infrastructure/__tests__/" tests defines general tests
@@ -171,7 +172,7 @@
->setType('class')
->setLibrary($library)
->setPathPrefix(($path ? $path.'/' : '').'__tests__/')
- ->setAncestorClass('ArcanistPhutilTestCase')
+ ->setAncestorClass('PhutilTestCase')
->setConcreteOnly(true)
->selectAndLoadSymbols();
diff --git a/src/unit/engine/XUnitTestEngine.php b/src/unit/engine/XUnitTestEngine.php
--- a/src/unit/engine/XUnitTestEngine.php
+++ b/src/unit/engine/XUnitTestEngine.php
@@ -89,7 +89,6 @@
* @return array Array of test results.
*/
public function run() {
-
$this->loadEnvironment();
if ($this->getRunAllTests()) {
diff --git a/src/unit/engine/phutil/ArcanistPhutilTestCase.php b/src/unit/engine/phutil/ArcanistPhutilTestCase.php
--- a/src/unit/engine/phutil/ArcanistPhutilTestCase.php
+++ b/src/unit/engine/phutil/ArcanistPhutilTestCase.php
@@ -16,7 +16,7 @@
private $results = array();
private $enableCoverage;
private $coverage = array();
- private $projectRoot;
+ private $workingCopy;
private $paths;
private $renderer;
@@ -560,7 +560,9 @@
$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;
}
@@ -583,7 +585,7 @@
$str .= 'N'; // Not executable.
}
}
- $coverage[substr($file, strlen($this->projectRoot) + 1)] = $str;
+ $coverage[substr($file, strlen($this->getProjectRoot()) + 1)] = $str;
}
// Only keep coverage information for files modified by the change. In
@@ -603,18 +605,40 @@
}
}
- 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() {
+ // TODO: What if $this->workingCopy isn't set.
+ return $this->getWorkingCopy()->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')
+ ->setQueryParam('repositories', '');
+
+ return (string)$uri;
}
public function setRenderer(ArcanistUnitRenderer $renderer) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 12:21 PM (2 d, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7713097
Default Alt Text
D12664.id30425.diff (4 KB)
Attached To
Mode
D12664: Improve getLink method for unit tests
Attached
Detach File
Event Timeline
Log In to Comment