mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-11 15:21:03 +01:00
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
This commit is contained in:
parent
53c9167953
commit
ac92f9bdfc
8 changed files with 34 additions and 13 deletions
|
@ -15,6 +15,7 @@ phutil_register_library_map(array(
|
||||||
'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php',
|
'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php',
|
||||||
'ArcanistApacheLicenseLinter' => 'lint/linter/ArcanistApacheLicenseLinter.php',
|
'ArcanistApacheLicenseLinter' => 'lint/linter/ArcanistApacheLicenseLinter.php',
|
||||||
'ArcanistApacheLicenseLinterTestCase' => 'lint/linter/__tests__/ArcanistApacheLicenseLinterTestCase.php',
|
'ArcanistApacheLicenseLinterTestCase' => 'lint/linter/__tests__/ArcanistApacheLicenseLinterTestCase.php',
|
||||||
|
'ArcanistArcanistLinterTestCase' => 'lint/linter/__tests__/ArcanistArcanistLinterTestCase.php',
|
||||||
'ArcanistBaseCommitParser' => 'parser/ArcanistBaseCommitParser.php',
|
'ArcanistBaseCommitParser' => 'parser/ArcanistBaseCommitParser.php',
|
||||||
'ArcanistBaseCommitParserTestCase' => 'parser/__tests__/ArcanistBaseCommitParserTestCase.php',
|
'ArcanistBaseCommitParserTestCase' => 'parser/__tests__/ArcanistBaseCommitParserTestCase.php',
|
||||||
'ArcanistBaseUnitTestEngine' => 'unit/engine/ArcanistBaseUnitTestEngine.php',
|
'ArcanistBaseUnitTestEngine' => 'unit/engine/ArcanistBaseUnitTestEngine.php',
|
||||||
|
@ -151,7 +152,8 @@ phutil_register_library_map(array(
|
||||||
'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter',
|
'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter',
|
||||||
'ArcanistApacheLicenseLinterTestCase' => 'ArcanistLinterTestCase',
|
'ArcanistApacheLicenseLinterTestCase' => 'ArcanistArcanistLinterTestCase',
|
||||||
|
'ArcanistArcanistLinterTestCase' => 'ArcanistLinterTestCase',
|
||||||
'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
|
'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
|
||||||
'ArcanistBranchWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistBranchWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistBundleTestCase' => 'ArcanistTestCase',
|
'ArcanistBundleTestCase' => 'ArcanistTestCase',
|
||||||
|
@ -192,7 +194,7 @@ phutil_register_library_map(array(
|
||||||
'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer',
|
'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer',
|
||||||
'ArcanistLintSummaryRenderer' => 'ArcanistLintRenderer',
|
'ArcanistLintSummaryRenderer' => 'ArcanistLintRenderer',
|
||||||
'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistLinterTestCase' => 'ArcanistTestCase',
|
'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase',
|
||||||
'ArcanistListWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistListWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistMarkCommittedWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistMarkCommittedWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI',
|
'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI',
|
||||||
|
@ -212,20 +214,20 @@ phutil_register_library_map(array(
|
||||||
'ArcanistPyFlakesLinter' => 'ArcanistLinter',
|
'ArcanistPyFlakesLinter' => 'ArcanistLinter',
|
||||||
'ArcanistPyLintLinter' => 'ArcanistLinter',
|
'ArcanistPyLintLinter' => 'ArcanistLinter',
|
||||||
'ArcanistRubyLinter' => 'ArcanistLinter',
|
'ArcanistRubyLinter' => 'ArcanistLinter',
|
||||||
'ArcanistRubyLinterTestCase' => 'ArcanistLinterTestCase',
|
'ArcanistRubyLinterTestCase' => 'ArcanistArcanistLinterTestCase',
|
||||||
'ArcanistScriptAndRegexLinter' => 'ArcanistLinter',
|
'ArcanistScriptAndRegexLinter' => 'ArcanistLinter',
|
||||||
'ArcanistSetConfigWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistSetConfigWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistShellCompleteWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistShellCompleteWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistSingleLintEngine' => 'ArcanistLintEngine',
|
'ArcanistSingleLintEngine' => 'ArcanistLintEngine',
|
||||||
'ArcanistSpellingLinter' => 'ArcanistLinter',
|
'ArcanistSpellingLinter' => 'ArcanistLinter',
|
||||||
'ArcanistSpellingLinterTestCase' => 'ArcanistLinterTestCase',
|
'ArcanistSpellingLinterTestCase' => 'ArcanistArcanistLinterTestCase',
|
||||||
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
|
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
|
||||||
'ArcanistSubversionHookAPI' => 'ArcanistHookAPI',
|
'ArcanistSubversionHookAPI' => 'ArcanistHookAPI',
|
||||||
'ArcanistSvnHookPreCommitWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistSvnHookPreCommitWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistTasksWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistTasksWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistTestCase' => 'ArcanistPhutilTestCase',
|
'ArcanistTestCase' => 'ArcanistPhutilTestCase',
|
||||||
'ArcanistTextLinter' => 'ArcanistLinter',
|
'ArcanistTextLinter' => 'ArcanistLinter',
|
||||||
'ArcanistTextLinterTestCase' => 'ArcanistLinterTestCase',
|
'ArcanistTextLinterTestCase' => 'ArcanistArcanistLinterTestCase',
|
||||||
'ArcanistTodoWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistTodoWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistUncommittedChangesException' => 'ArcanistUsageException',
|
'ArcanistUncommittedChangesException' => 'ArcanistUsageException',
|
||||||
'ArcanistUnitWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistUnitWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
|
@ -236,7 +238,7 @@ phutil_register_library_map(array(
|
||||||
'ArcanistWhichWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistWhichWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistXHPASTLintNamingHookTestCase' => 'ArcanistTestCase',
|
'ArcanistXHPASTLintNamingHookTestCase' => 'ArcanistTestCase',
|
||||||
'ArcanistXHPASTLinter' => 'ArcanistLinter',
|
'ArcanistXHPASTLinter' => 'ArcanistLinter',
|
||||||
'ArcanistXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
|
'ArcanistXHPASTLinterTestCase' => 'ArcanistArcanistLinterTestCase',
|
||||||
'ComprehensiveLintEngine' => 'ArcanistLintEngine',
|
'ComprehensiveLintEngine' => 'ArcanistLintEngine',
|
||||||
'ExampleLintEngine' => 'ArcanistLintEngine',
|
'ExampleLintEngine' => 'ArcanistLintEngine',
|
||||||
'NoseTestEngine' => 'ArcanistBaseUnitTestEngine',
|
'NoseTestEngine' => 'ArcanistBaseUnitTestEngine',
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
*
|
*
|
||||||
* @group testcase
|
* @group testcase
|
||||||
*/
|
*/
|
||||||
final class ArcanistApacheLicenseLinterTestCase extends ArcanistLinterTestCase {
|
final class ArcanistApacheLicenseLinterTestCase
|
||||||
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testApacheLicenseLint() {
|
public function testApacheLicenseLint() {
|
||||||
$linter = new ArcanistApacheLicenseLinter();
|
$linter = new ArcanistApacheLicenseLinter();
|
||||||
|
|
17
src/lint/linter/__tests__/ArcanistArcanistLinterTestCase.php
Normal file
17
src/lint/linter/__tests__/ArcanistArcanistLinterTestCase.php
Normal file
|
@ -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
|
* @group testcase
|
||||||
*/
|
*/
|
||||||
abstract class ArcanistLinterTestCase extends ArcanistTestCase {
|
abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
||||||
|
|
||||||
public function executeTestsInDirectory($root, $linter, $working_copy) {
|
public function executeTestsInDirectory($root, $linter, $working_copy) {
|
||||||
foreach (Filesystem::listDirectory($root, $hidden = false) as $file) {
|
foreach (Filesystem::listDirectory($root, $hidden = false) as $file) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* @group testcase
|
* @group testcase
|
||||||
*/
|
*/
|
||||||
final class ArcanistRubyLinterTestCase extends ArcanistLinterTestCase {
|
final class ArcanistRubyLinterTestCase extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testRubyLint() {
|
public function testRubyLint() {
|
||||||
$linter = new ArcanistRubyLinter();
|
$linter = new ArcanistRubyLinter();
|
||||||
|
@ -17,4 +17,3 @@ final class ArcanistRubyLinterTestCase extends ArcanistLinterTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
*
|
*
|
||||||
* @group testcase
|
* @group testcase
|
||||||
*/
|
*/
|
||||||
final class ArcanistSpellingLinterTestCase extends ArcanistLinterTestCase {
|
final class ArcanistSpellingLinterTestCase
|
||||||
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testSpellingLint() {
|
public function testSpellingLint() {
|
||||||
$linter = new ArcanistSpellingLinter();
|
$linter = new ArcanistSpellingLinter();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* @group testcase
|
* @group testcase
|
||||||
*/
|
*/
|
||||||
final class ArcanistTextLinterTestCase extends ArcanistLinterTestCase {
|
final class ArcanistTextLinterTestCase extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testTextLint() {
|
public function testTextLint() {
|
||||||
$linter = new ArcanistTextLinter();
|
$linter = new ArcanistTextLinter();
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
*
|
*
|
||||||
* @group testcase
|
* @group testcase
|
||||||
*/
|
*/
|
||||||
final class ArcanistXHPASTLinterTestCase extends ArcanistLinterTestCase {
|
final class ArcanistXHPASTLinterTestCase
|
||||||
|
extends ArcanistArcanistLinterTestCase {
|
||||||
|
|
||||||
public function testXHPASTLint() {
|
public function testXHPASTLint() {
|
||||||
$linter = new ArcanistXHPASTLinter();
|
$linter = new ArcanistXHPASTLinter();
|
||||||
|
|
Loading…
Reference in a new issue