1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +01:00

Rename ArcanistPhutilTestCase to PhutilTestCase and Remove ArcanistTestCase

Summary: Ref T7977. The `ArcanistTestCase` class is pointless and can be replaced by `ArcanistPhutilTestCase`. Furthermore, it sorta makes sense to just rename `ArcanistPhutilTestCase` to `PhutilTestCase`. Depends on D12664 and D12666.

Test Plan: `arc unit`

Reviewers: avivey, #blessed_reviewers, epriestley

Reviewed By: avivey, #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

Maniphest Tasks: T7977

Differential Revision: https://secure.phabricator.com/D12665
This commit is contained in:
Joshua Spence 2015-05-20 09:37:44 +10:00
parent 399f040018
commit 753705b2c5
24 changed files with 67 additions and 71 deletions

View file

@ -138,10 +138,6 @@ phutil_register_library_map(array(
'ArcanistPhpunitTestResultParser' => 'unit/parser/ArcanistPhpunitTestResultParser.php',
'ArcanistPhrequentWorkflow' => 'workflow/ArcanistPhrequentWorkflow.php',
'ArcanistPhutilLibraryLinter' => 'lint/linter/ArcanistPhutilLibraryLinter.php',
'ArcanistPhutilTestCase' => 'unit/engine/phutil/ArcanistPhutilTestCase.php',
'ArcanistPhutilTestCaseTestCase' => 'unit/engine/phutil/testcase/ArcanistPhutilTestCaseTestCase.php',
'ArcanistPhutilTestSkippedException' => 'unit/engine/phutil/testcase/ArcanistPhutilTestSkippedException.php',
'ArcanistPhutilTestTerminatedException' => 'unit/engine/phutil/testcase/ArcanistPhutilTestTerminatedException.php',
'ArcanistPhutilXHPASTLinter' => 'lint/linter/ArcanistPhutilXHPASTLinter.php',
'ArcanistPhutilXHPASTLinterTestCase' => 'lint/linter/__tests__/ArcanistPhutilXHPASTLinterTestCase.php',
'ArcanistPuppetLintLinter' => 'lint/linter/ArcanistPuppetLintLinter.php',
@ -170,7 +166,6 @@ phutil_register_library_map(array(
'ArcanistSubversionAPI' => 'repository/api/ArcanistSubversionAPI.php',
'ArcanistSummaryLintRenderer' => 'lint/renderer/ArcanistSummaryLintRenderer.php',
'ArcanistTasksWorkflow' => 'workflow/ArcanistTasksWorkflow.php',
'ArcanistTestCase' => 'infrastructure/testing/ArcanistTestCase.php',
'ArcanistTestResultParser' => 'unit/parser/ArcanistTestResultParser.php',
'ArcanistTestXHPASTLintSwitchHook' => 'lint/linter/__tests__/ArcanistTestXHPASTLintSwitchHook.php',
'ArcanistTextLinter' => 'lint/linter/ArcanistTextLinter.php',
@ -204,6 +199,10 @@ phutil_register_library_map(array(
'NoseTestEngine' => 'unit/engine/NoseTestEngine.php',
'PhpunitTestEngine' => 'unit/engine/PhpunitTestEngine.php',
'PhpunitTestEngineTestCase' => 'unit/engine/__tests__/PhpunitTestEngineTestCase.php',
'PhutilTestCase' => 'unit/engine/phutil/PhutilTestCase.php',
'PhutilTestCaseTestCase' => 'unit/engine/phutil/testcase/PhutilTestCaseTestCase.php',
'PhutilTestSkippedException' => 'unit/engine/phutil/testcase/PhutilTestSkippedException.php',
'PhutilTestTerminatedException' => 'unit/engine/phutil/testcase/PhutilTestTerminatedException.php',
'PhutilUnitTestEngine' => 'unit/engine/PhutilUnitTestEngine.php',
'PhutilUnitTestEngineTestCase' => 'unit/engine/__tests__/PhutilUnitTestEngineTestCase.php',
'PytestTestEngine' => 'unit/engine/PytestTestEngine.php',
@ -216,13 +215,13 @@ phutil_register_library_map(array(
'ArcanistAmendWorkflow' => 'ArcanistWorkflow',
'ArcanistAnoidWorkflow' => 'ArcanistWorkflow',
'ArcanistBackoutWorkflow' => 'ArcanistWorkflow',
'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
'ArcanistBaseCommitParserTestCase' => 'PhutilTestCase',
'ArcanistBaseXHPASTLinter' => 'ArcanistFutureLinter',
'ArcanistBookmarkWorkflow' => 'ArcanistFeatureWorkflow',
'ArcanistBranchWorkflow' => 'ArcanistFeatureWorkflow',
'ArcanistBritishTestCase' => 'ArcanistTestCase',
'ArcanistBritishTestCase' => 'PhutilTestCase',
'ArcanistBrowseWorkflow' => 'ArcanistWorkflow',
'ArcanistBundleTestCase' => 'ArcanistTestCase',
'ArcanistBundleTestCase' => 'PhutilTestCase',
'ArcanistCSSLintLinter' => 'ArcanistExternalLinter',
'ArcanistCSSLintLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistCSharpLinter' => 'ArcanistLinter',
@ -237,7 +236,7 @@ phutil_register_library_map(array(
'ArcanistClosureLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistCoffeeLintLinter' => 'ArcanistExternalLinter',
'ArcanistCoffeeLintLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistCommentRemoverTestCase' => 'ArcanistTestCase',
'ArcanistCommentRemoverTestCase' => 'PhutilTestCase',
'ArcanistCommitWorkflow' => 'ArcanistWorkflow',
'ArcanistCompilerLintRenderer' => 'ArcanistLintRenderer',
'ArcanistComprehensiveLintEngine' => 'ArcanistLintEngine',
@ -248,8 +247,8 @@ phutil_register_library_map(array(
'ArcanistCppcheckLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistCpplintLinter' => 'ArcanistExternalLinter',
'ArcanistCpplintLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistDiffParserTestCase' => 'ArcanistTestCase',
'ArcanistDiffUtilsTestCase' => 'ArcanistTestCase',
'ArcanistDiffParserTestCase' => 'PhutilTestCase',
'ArcanistDiffUtilsTestCase' => 'PhutilTestCase',
'ArcanistDiffWorkflow' => 'ArcanistWorkflow',
'ArcanistDifferentialCommitMessageParserException' => 'Exception',
'ArcanistDifferentialDependencyGraph' => 'AbstractDirectedGraph',
@ -272,7 +271,7 @@ phutil_register_library_map(array(
'ArcanistGoLintLinter' => 'ArcanistExternalLinter',
'ArcanistGoLintLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistGoTestResultParser' => 'ArcanistTestResultParser',
'ArcanistGoTestResultParserTestCase' => 'ArcanistTestCase',
'ArcanistGoTestResultParserTestCase' => 'PhutilTestCase',
'ArcanistHLintLinter' => 'ArcanistExternalLinter',
'ArcanistHLintLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistHelpWorkflow' => 'ArcanistWorkflow',
@ -294,11 +293,11 @@ phutil_register_library_map(array(
'ArcanistLiberateWorkflow' => 'ArcanistWorkflow',
'ArcanistLibraryTestCase' => 'PhutilLibraryTestCase',
'ArcanistLintWorkflow' => 'ArcanistWorkflow',
'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase',
'ArcanistLinterTestCase' => 'PhutilTestCase',
'ArcanistLintersWorkflow' => 'ArcanistWorkflow',
'ArcanistListWorkflow' => 'ArcanistWorkflow',
'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI',
'ArcanistMercurialParserTestCase' => 'ArcanistTestCase',
'ArcanistMercurialParserTestCase' => 'PhutilTestCase',
'ArcanistMergeConflictLinter' => 'ArcanistLinter',
'ArcanistMergeConflictLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistMissingLinterException' => 'Exception',
@ -318,9 +317,6 @@ phutil_register_library_map(array(
'ArcanistPhpunitTestResultParser' => 'ArcanistTestResultParser',
'ArcanistPhrequentWorkflow' => 'ArcanistWorkflow',
'ArcanistPhutilLibraryLinter' => 'ArcanistLinter',
'ArcanistPhutilTestCaseTestCase' => 'ArcanistPhutilTestCase',
'ArcanistPhutilTestSkippedException' => 'Exception',
'ArcanistPhutilTestTerminatedException' => 'Exception',
'ArcanistPhutilXHPASTLinter' => 'ArcanistBaseXHPASTLinter',
'ArcanistPhutilXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistPuppetLintLinter' => 'ArcanistExternalLinter',
@ -329,8 +325,8 @@ phutil_register_library_map(array(
'ArcanistPyFlakesLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistPyLintLinter' => 'ArcanistExternalLinter',
'ArcanistPyLintLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistRepositoryAPIMiscTestCase' => 'ArcanistTestCase',
'ArcanistRepositoryAPIStateTestCase' => 'ArcanistTestCase',
'ArcanistRepositoryAPIMiscTestCase' => 'PhutilTestCase',
'ArcanistRepositoryAPIStateTestCase' => 'PhutilTestCase',
'ArcanistRevertWorkflow' => 'ArcanistWorkflow',
'ArcanistRuboCopLinter' => 'ArcanistExternalLinter',
'ArcanistRuboCopLinterTestCase' => 'ArcanistExternalLinterTestCase',
@ -347,7 +343,6 @@ phutil_register_library_map(array(
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
'ArcanistSummaryLintRenderer' => 'ArcanistLintRenderer',
'ArcanistTasksWorkflow' => 'ArcanistWorkflow',
'ArcanistTestCase' => 'ArcanistPhutilTestCase',
'ArcanistTestXHPASTLintSwitchHook' => 'ArcanistXHPASTLintSwitchHook',
'ArcanistTextLinter' => 'ArcanistLinter',
'ArcanistTextLinterTestCase' => 'ArcanistLinterTestCase',
@ -364,7 +359,7 @@ phutil_register_library_map(array(
'ArcanistVersionWorkflow' => 'ArcanistWorkflow',
'ArcanistWhichWorkflow' => 'ArcanistWorkflow',
'ArcanistWorkflow' => 'Phobject',
'ArcanistXHPASTLintNamingHookTestCase' => 'ArcanistTestCase',
'ArcanistXHPASTLintNamingHookTestCase' => 'PhutilTestCase',
'ArcanistXHPASTLinter' => 'ArcanistBaseXHPASTLinter',
'ArcanistXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistXMLLinter' => 'ArcanistLinter',
@ -372,11 +367,14 @@ phutil_register_library_map(array(
'CSharpToolsTestEngine' => 'XUnitTestEngine',
'NoseTestEngine' => 'ArcanistUnitTestEngine',
'PhpunitTestEngine' => 'ArcanistUnitTestEngine',
'PhpunitTestEngineTestCase' => 'ArcanistTestCase',
'PhpunitTestEngineTestCase' => 'PhutilTestCase',
'PhutilTestCaseTestCase' => 'PhutilTestCase',
'PhutilTestSkippedException' => 'Exception',
'PhutilTestTerminatedException' => 'Exception',
'PhutilUnitTestEngine' => 'ArcanistUnitTestEngine',
'PhutilUnitTestEngineTestCase' => 'ArcanistTestCase',
'PhutilUnitTestEngineTestCase' => 'PhutilTestCase',
'PytestTestEngine' => 'ArcanistUnitTestEngine',
'XUnitTestEngine' => 'ArcanistUnitTestEngine',
'XUnitTestResultParserTestCase' => 'ArcanistTestCase',
'XUnitTestResultParserTestCase' => 'PhutilTestCase',
),
));

View file

@ -1,6 +1,6 @@
<?php
final class ArcanistBritishTestCase extends ArcanistTestCase {
final class ArcanistBritishTestCase extends PhutilTestCase {
public function testCommandCompletion() {
$this->assertCommandCompletion(

View file

@ -3,7 +3,7 @@
/**
* Test cases for @{class:ArcanistDiffUtils}.
*/
final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
final class ArcanistDiffUtilsTestCase extends PhutilTestCase {
public function testLevenshtein() {
$tests = array(

View file

@ -1,3 +0,0 @@
<?php
abstract class ArcanistTestCase extends ArcanistPhutilTestCase {}

View file

@ -3,7 +3,7 @@
/**
* Facilitates implementation of test cases for @{class:ArcanistLinter}s.
*/
abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
abstract class ArcanistLinterTestCase extends PhutilTestCase {
/**
* Returns an instance of the linter being tested.
@ -148,7 +148,7 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
$result = reset($results);
$patcher = ArcanistLintPatcher::newFromArcanistLintResult($result);
$after_lint = $patcher->getModifiedFileContent();
} catch (ArcanistPhutilTestTerminatedException $ex) {
} catch (PhutilTestTerminatedException $ex) {
throw $ex;
} catch (Exception $exception) {
$caught_exception = true;

View file

@ -3,7 +3,8 @@
/**
* Test cases for @{class:ArcanistXHPASTLintNamingHook}.
*/
final class ArcanistXHPASTLintNamingHookTestCase extends ArcanistTestCase {
final class ArcanistXHPASTLintNamingHookTestCase
extends PhutilTestCase {
public function testCaseUtilities() {
$tests = array(

View file

@ -1,6 +1,6 @@
<?php
final class ArcanistBaseCommitParserTestCase extends ArcanistTestCase {
final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
public function testBasics() {
// Verify that the very basics of base commit resolution work.

View file

@ -1,6 +1,6 @@
<?php
final class ArcanistBundleTestCase extends ArcanistTestCase {
final class ArcanistBundleTestCase extends PhutilTestCase {
private function loadResource($name) {
return Filesystem::readFile($this->getResourcePath($name));

View file

@ -1,6 +1,6 @@
<?php
final class ArcanistCommentRemoverTestCase extends ArcanistTestCase {
final class ArcanistCommentRemoverTestCase extends PhutilTestCase {
public function testRemover() {
$test = <<<EOTEXT

View file

@ -3,7 +3,7 @@
/**
* Test cases for @{class:ArcanistDiffParser}.
*/
final class ArcanistDiffParserTestCase extends ArcanistTestCase {
final class ArcanistDiffParserTestCase extends PhutilTestCase {
public function testParser() {
$root = dirname(__FILE__).'/diff/';

View file

@ -1,6 +1,6 @@
<?php
final class ArcanistRepositoryAPIMiscTestCase extends ArcanistTestCase {
final class ArcanistRepositoryAPIMiscTestCase extends PhutilTestCase {
public function testSVNFileEscapes() {
$input = array(

View file

@ -1,6 +1,6 @@
<?php
final class ArcanistRepositoryAPIStateTestCase extends ArcanistTestCase {
final class ArcanistRepositoryAPIStateTestCase extends PhutilTestCase {
public function testGitStateParsing() {
if (Filesystem::binaryExists('git')) {

View file

@ -1,6 +1,6 @@
<?php
final class ArcanistMercurialParserTestCase extends ArcanistTestCase {
final class ArcanistMercurialParserTestCase extends PhutilTestCase {
public function testParseAll() {
$root = dirname(__FILE__).'/mercurial/';

View file

@ -75,7 +75,7 @@ final class PhutilUnitTestEngine extends ArcanistUnitTestEngine {
$symbols = id(new PhutilSymbolLoader())
->setType('class')
->setAncestorClass('ArcanistPhutilTestCase')
->setAncestorClass('PhutilTestCase')
->setConcreteOnly(true)
->selectSymbolsWithoutLoading();
@ -163,8 +163,8 @@ final class PhutilUnitTestEngine extends ArcanistUnitTestEngine {
}
}
// Look for any class that extends ArcanistPhutilTestCase inside a
// __tests__ directory in any parent directory of every affected file.
// 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
// for all of "infrastructure/", and those tests run for any change in
@ -181,7 +181,7 @@ final class PhutilUnitTestEngine extends ArcanistUnitTestEngine {
->setType('class')
->setLibrary($library)
->setPathPrefix(($path ? $path.'/' : '').'__tests__/')
->setAncestorClass('ArcanistPhutilTestCase')
->setAncestorClass('PhutilTestCase')
->setConcreteOnly(true)
->selectAndLoadSymbols();

View file

@ -3,7 +3,7 @@
/**
* Tests for @{class:PhpunitTestEngine}.
*/
final class PhpunitTestEngineTestCase extends ArcanistTestCase {
final class PhpunitTestEngineTestCase extends PhutilTestCase {
public function testSearchLocations() {
$path = '/path/to/some/file/X.php';

View file

@ -3,7 +3,7 @@
/**
* Very meta test for @{class:PhutilUnitTestEngine}.
*/
final class PhutilUnitTestEngineTestCase extends ArcanistTestCase {
final class PhutilUnitTestEngineTestCase extends PhutilTestCase {
private static $allTestsCounter = 0;
private static $oneTestCounter = 0;
@ -76,7 +76,7 @@ final class PhutilUnitTestEngineTestCase extends ArcanistTestCase {
$failed = 0;
$skipped = 0;
$test_case = id(new ArcanistPhutilTestCaseTestCase())
$test_case = id(new PhutilTestCaseTestCase())
->setWorkingCopy($this->getWorkingCopy());
foreach ($test_case->run() as $result) {

View file

@ -8,7 +8,7 @@
* @task hook Hooks for Setup and Teardown
* @task internal Internals
*/
abstract class ArcanistPhutilTestCase {
abstract class PhutilTestCase {
private $assertions = 0;
private $runningTest;
@ -122,7 +122,7 @@ abstract class ArcanistPhutilTestCase {
}
$this->failTest($output);
throw new ArcanistPhutilTestTerminatedException($output);
throw new PhutilTestTerminatedException($output);
}
@ -137,7 +137,7 @@ abstract class ArcanistPhutilTestCase {
*/
final protected function assertFailure($message) {
$this->failTest($message);
throw new ArcanistPhutilTestTerminatedException($message);
throw new PhutilTestTerminatedException($message);
}
/**
@ -150,7 +150,7 @@ abstract class ArcanistPhutilTestCase {
*/
final protected function assertSkipped($message) {
$this->skipTest($message);
throw new ArcanistPhutilTestSkippedException($message);
throw new PhutilTestSkippedException($message);
}
@ -230,7 +230,7 @@ abstract class ArcanistPhutilTestCase {
try {
call_user_func($callable, $input);
} catch (Exception $ex) {
if ($ex instanceof ArcanistPhutilTestTerminatedException) {
if ($ex instanceof PhutilTestTerminatedException) {
throw $ex;
}
if (!($ex instanceof $exception_class)) {
@ -363,7 +363,7 @@ abstract class ArcanistPhutilTestCase {
* This hook is invoked once, before any test cases execute. It gives you
* an opportunity to perform setup steps for the entire suite of test cases.
*
* @param list<ArcanistPhutilTestCase> List of test cases to be run.
* @param list<PhutilTestCase> List of test cases to be run.
* @return void
* @task hook
*/
@ -375,7 +375,7 @@ abstract class ArcanistPhutilTestCase {
/**
* This hook is invoked once, after all test cases execute.
*
* @param list<ArcanistPhutilTestCase> List of test cases that ran.
* @param list<PhutilTestCase> List of test cases that ran.
* @return void
* @task hook
*/
@ -515,9 +515,9 @@ abstract class ArcanistPhutilTestCase {
'least one assertion.'));
}
} catch (ArcanistPhutilTestTerminatedException $ex) {
} catch (PhutilTestTerminatedException $ex) {
// Continue with the next test.
} catch (ArcanistPhutilTestSkippedException $ex) {
} catch (PhutilTestSkippedException $ex) {
// Continue with the next test.
} catch (Exception $ex) {
$ex_class = get_class($ex);
@ -736,7 +736,7 @@ abstract class ArcanistPhutilTestCase {
$output = $description."\n\n".$header."\n".$actual_result;
$this->failTest($output);
throw new ArcanistPhutilTestTerminatedException($output);
throw new PhutilTestTerminatedException($output);
}
}

View file

@ -1,6 +0,0 @@
<?php
/**
* Thrown to skip test execution.
*/
final class ArcanistPhutilTestSkippedException extends Exception {}

View file

@ -1,6 +0,0 @@
<?php
/**
* Thrown to prematurely end test execution.
*/
final class ArcanistPhutilTestTerminatedException extends Exception {}

View file

@ -3,7 +3,7 @@
/**
* Test for @{class:PhutilUnitTestEngineTestCase}.
*/
final class ArcanistPhutilTestCaseTestCase extends ArcanistPhutilTestCase {
final class PhutilTestCaseTestCase extends PhutilTestCase {
public function testFail() {
$this->assertFailure(pht('This test is expected to fail.'));

View file

@ -0,0 +1,6 @@
<?php
/**
* Thrown to skip test execution.
*/
final class PhutilTestSkippedException extends Exception {}

View file

@ -0,0 +1,6 @@
<?php
/**
* Thrown to prematurely end test execution.
*/
final class PhutilTestTerminatedException extends Exception {}

View file

@ -3,7 +3,7 @@
/**
* Test for @{class:ArcanistGoTestResultParser}.
*/
final class ArcanistGoTestResultParserTestCase extends ArcanistTestCase {
final class ArcanistGoTestResultParserTestCase extends PhutilTestCase {
public function testSingleTestCaseSuccessful() {
$stubbed_results = Filesystem::readFile(

View file

@ -3,7 +3,7 @@
/**
* Test for @{class:ArcanistXUnitTestResultParser}.
*/
final class XUnitTestResultParserTestCase extends ArcanistTestCase {
final class XUnitTestResultParserTestCase extends PhutilTestCase {
public function testAcceptsNoTestsInput() {
$stubbed_results = Filesystem::readFile(