Permalink
Browse files

Remove getLink() from ArcanistLinterTestCase

Summary:
Installations extend this.

Another solution would be to extend `ArcanistLinterTestCase` from `ArcanistArcanistLinterTestCase` and return null in `getLink()` to avoid code duplication but I prefer clean class hierarchy.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3878
  • Loading branch information...
1 parent 53c9167 commit ac92f9bdfc7a72e5e2106f8e56ef086568397835 vrana committed Nov 3, 2012
@@ -15,6 +15,7 @@
'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php',
'ArcanistApacheLicenseLinter' => 'lint/linter/ArcanistApacheLicenseLinter.php',
'ArcanistApacheLicenseLinterTestCase' => 'lint/linter/__tests__/ArcanistApacheLicenseLinterTestCase.php',
+ 'ArcanistArcanistLinterTestCase' => 'lint/linter/__tests__/ArcanistArcanistLinterTestCase.php',
'ArcanistBaseCommitParser' => 'parser/ArcanistBaseCommitParser.php',
'ArcanistBaseCommitParserTestCase' => 'parser/__tests__/ArcanistBaseCommitParserTestCase.php',
'ArcanistBaseUnitTestEngine' => 'unit/engine/ArcanistBaseUnitTestEngine.php',
@@ -151,7 +152,8 @@
'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter',
- 'ArcanistApacheLicenseLinterTestCase' => 'ArcanistLinterTestCase',
+ 'ArcanistApacheLicenseLinterTestCase' => 'ArcanistArcanistLinterTestCase',
+ 'ArcanistArcanistLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
'ArcanistBranchWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistBundleTestCase' => 'ArcanistTestCase',
@@ -192,7 +194,7 @@
'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer',
'ArcanistLintSummaryRenderer' => 'ArcanistLintRenderer',
'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow',
- 'ArcanistLinterTestCase' => 'ArcanistTestCase',
+ 'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase',
'ArcanistListWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistMarkCommittedWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI',
@@ -212,20 +214,20 @@
'ArcanistPyFlakesLinter' => 'ArcanistLinter',
'ArcanistPyLintLinter' => 'ArcanistLinter',
'ArcanistRubyLinter' => 'ArcanistLinter',
- 'ArcanistRubyLinterTestCase' => 'ArcanistLinterTestCase',
+ 'ArcanistRubyLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ArcanistScriptAndRegexLinter' => 'ArcanistLinter',
'ArcanistSetConfigWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistShellCompleteWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistSingleLintEngine' => 'ArcanistLintEngine',
'ArcanistSpellingLinter' => 'ArcanistLinter',
- 'ArcanistSpellingLinterTestCase' => 'ArcanistLinterTestCase',
+ 'ArcanistSpellingLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
'ArcanistSubversionHookAPI' => 'ArcanistHookAPI',
'ArcanistSvnHookPreCommitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistTasksWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistTestCase' => 'ArcanistPhutilTestCase',
'ArcanistTextLinter' => 'ArcanistLinter',
- 'ArcanistTextLinterTestCase' => 'ArcanistLinterTestCase',
+ 'ArcanistTextLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ArcanistTodoWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistUncommittedChangesException' => 'ArcanistUsageException',
'ArcanistUnitWorkflow' => 'ArcanistBaseWorkflow',
@@ -236,7 +238,7 @@
'ArcanistWhichWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistXHPASTLintNamingHookTestCase' => 'ArcanistTestCase',
'ArcanistXHPASTLinter' => 'ArcanistLinter',
- 'ArcanistXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
+ 'ArcanistXHPASTLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ComprehensiveLintEngine' => 'ArcanistLintEngine',
'ExampleLintEngine' => 'ArcanistLintEngine',
'NoseTestEngine' => 'ArcanistBaseUnitTestEngine',
@@ -5,7 +5,8 @@
*
* @group testcase
*/
-final class ArcanistApacheLicenseLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistApacheLicenseLinterTestCase
+ extends ArcanistArcanistLinterTestCase {
public function testApacheLicenseLint() {
$linter = new ArcanistApacheLicenseLinter();
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * @group testcase
+ */
+abstract class ArcanistArcanistLinterTestCase extends ArcanistLinterTestCase {
+
+ protected function getLink($method) {
+ // This could be converted to trait from ArcanistTestCase.
+ $arcanist_project = 'PHID-APRJ-703e0b140530f17ede30';
+ return
+ 'https://secure.phabricator.com/diffusion/symbol/'.$method.
+ '/?lang=php&projects='.$arcanist_project.
+ '&jump=true&context='.get_class($this);
+ }
+
+}
@@ -5,7 +5,7 @@
*
* @group testcase
*/
-abstract class ArcanistLinterTestCase extends ArcanistTestCase {
+abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
public function executeTestsInDirectory($root, $linter, $working_copy) {
foreach (Filesystem::listDirectory($root, $hidden = false) as $file) {
@@ -5,7 +5,7 @@
*
* @group testcase
*/
-final class ArcanistRubyLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistRubyLinterTestCase extends ArcanistArcanistLinterTestCase {
public function testRubyLint() {
$linter = new ArcanistRubyLinter();
@@ -17,4 +17,3 @@ public function testRubyLint() {
}
}
-
@@ -5,7 +5,8 @@
*
* @group testcase
*/
-final class ArcanistSpellingLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistSpellingLinterTestCase
+ extends ArcanistArcanistLinterTestCase {
public function testSpellingLint() {
$linter = new ArcanistSpellingLinter();
@@ -5,7 +5,7 @@
*
* @group testcase
*/
-final class ArcanistTextLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistTextLinterTestCase extends ArcanistArcanistLinterTestCase {
public function testTextLint() {
$linter = new ArcanistTextLinter();
@@ -5,7 +5,8 @@
*
* @group testcase
*/
-final class ArcanistXHPASTLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistXHPASTLinterTestCase
+ extends ArcanistArcanistLinterTestCase {
public function testXHPASTLint() {
$linter = new ArcanistXHPASTLinter();

0 comments on commit ac92f9b

Please sign in to comment.