]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Remove getLink() from ArcanistLinterTestCase
authorvrana <jakubv@fb.com>
Sat, 3 Nov 2012 01:09:38 +0000 (18:09 -0700)
committervrana <jakubv@fb.com>
Wed, 7 Nov 2012 18:12:24 +0000 (10:12 -0800)
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

src/__phutil_library_map__.php
src/lint/linter/__tests__/ArcanistApacheLicenseLinterTestCase.php
src/lint/linter/__tests__/ArcanistArcanistLinterTestCase.php [new file with mode: 0644]
src/lint/linter/__tests__/ArcanistLinterTestCase.php
src/lint/linter/__tests__/ArcanistRubyLinterTestCase.php
src/lint/linter/__tests__/ArcanistSpellingLinterTestCase.php
src/lint/linter/__tests__/ArcanistTextLinterTestCase.php
src/lint/linter/__tests__/ArcanistXHPASTLinterTestCase.php

index acbcf472019d630aec2aa5cac4b60c33081ea038..22800f0f19b7ffe04bdc3d3c460e46ed9954e666 100644 (file)
@@ -15,6 +15,7 @@ phutil_register_library_map(array(
     '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 @@ phutil_register_library_map(array(
     'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter',
-    'ArcanistApacheLicenseLinterTestCase' => 'ArcanistLinterTestCase',
+    'ArcanistApacheLicenseLinterTestCase' => 'ArcanistArcanistLinterTestCase',
+    'ArcanistArcanistLinterTestCase' => 'ArcanistLinterTestCase',
     'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
     'ArcanistBranchWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistBundleTestCase' => 'ArcanistTestCase',
@@ -192,7 +194,7 @@ phutil_register_library_map(array(
     'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer',
     'ArcanistLintSummaryRenderer' => 'ArcanistLintRenderer',
     'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow',
-    'ArcanistLinterTestCase' => 'ArcanistTestCase',
+    'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase',
     'ArcanistListWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistMarkCommittedWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI',
@@ -212,20 +214,20 @@ phutil_register_library_map(array(
     '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 @@ phutil_register_library_map(array(
     'ArcanistWhichWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistXHPASTLintNamingHookTestCase' => 'ArcanistTestCase',
     'ArcanistXHPASTLinter' => 'ArcanistLinter',
-    'ArcanistXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
+    'ArcanistXHPASTLinterTestCase' => 'ArcanistArcanistLinterTestCase',
     'ComprehensiveLintEngine' => 'ArcanistLintEngine',
     'ExampleLintEngine' => 'ArcanistLintEngine',
     'NoseTestEngine' => 'ArcanistBaseUnitTestEngine',
index 72b79911abbf2897f88325cf3d4e7a0b14924ed5..b8d6bb79f0b8c8120a38a35111cc26ef0500becf 100644 (file)
@@ -5,7 +5,8 @@
  *
  * @group testcase
  */
-final class ArcanistApacheLicenseLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistApacheLicenseLinterTestCase
+  extends ArcanistArcanistLinterTestCase {
 
   public function testApacheLicenseLint() {
     $linter = new ArcanistApacheLicenseLinter();
diff --git a/src/lint/linter/__tests__/ArcanistArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistArcanistLinterTestCase.php
new file mode 100644 (file)
index 0000000..d8fa684
--- /dev/null
@@ -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);
+  }
+
+}
index 2873fb509ab4a1ec82379ff7795009f75642c141..dc0785c4c0918daf0fd54f71b9ce99ebef1ebe9a 100644 (file)
@@ -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) {
index 23b473987e5b1c73227eb2577c3df6e250439ac4..a2373003b2fd2ff795fdf4b5f97bc3c28f2ba82b 100644 (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 @@ final class ArcanistRubyLinterTestCase extends ArcanistLinterTestCase {
   }
 
 }
-
index c66ad91f7e299843f61793454e60fccd6400befc..5704551998163217cd263d5e8abfd0fbd447bbda 100644 (file)
@@ -5,7 +5,8 @@
  *
  * @group testcase
  */
-final class ArcanistSpellingLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistSpellingLinterTestCase
+  extends ArcanistArcanistLinterTestCase {
 
   public function testSpellingLint() {
     $linter = new ArcanistSpellingLinter();
index 22bcf1dec27063d4a22e8c5333e3cacafde7f82b..da6bc8b1d66613340ee7fde760961fa3b33f6d4b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * @group testcase
  */
-final class ArcanistTextLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistTextLinterTestCase extends ArcanistArcanistLinterTestCase {
 
   public function testTextLint() {
     $linter = new ArcanistTextLinter();
index 11a3eba9d59cbd41317378786bd782e95015afe2..492467c3dbb2b80b52c491c9e11b9869fd62ac2a 100644 (file)
@@ -5,7 +5,8 @@
  *
  * @group testcase
  */
-final class ArcanistXHPASTLinterTestCase extends ArcanistLinterTestCase {
+final class ArcanistXHPASTLinterTestCase
+  extends ArcanistArcanistLinterTestCase {
 
   public function testXHPASTLint() {
     $linter = new ArcanistXHPASTLinter();