phpunit: Remove superfluous Title::clearCaches() calls
Why: - Various tests have been calling Title::clearCaches() on an ad-hoc basis at the end of test methods, or in tearDown(), to work around stale Title instances persisting across tests in Title's internal caches. - MediaWikiIntegrationTestCase takes care of this since Ie6cac7e1282f794277dfc8ff3673f12e9969818c, making these calls unnecessary. What: - Remove now-redundant Title::clearCaches() calls from tearDown() overrides and the end of test methods. - Preserve in-test Title::clearCaches() calls that are likely intended to force internal caches to reflect changes happening within the test itself. Bug: T395214 Change-Id: Ib5d42389cef20f3839c7f7a80041d002f0f09449 (cherry picked from commit 6483181044496c339ad497cc885319b20de7f6e7)
This commit is contained in:
parent
7d44a728b6
commit
8e14ff1bc0
7 changed files with 1 additions and 24 deletions
|
|
@ -448,11 +448,6 @@ class WikiModuleTest extends ResourceLoaderTestCase {
|
|||
'Redirect resolved by getContent'
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown(): void {
|
||||
Title::clearCaches();
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
class TestResourceLoaderWikiModule extends WikiModule {
|
||||
|
|
|
|||
|
|
@ -138,8 +138,6 @@ class ApiComparePagesTest extends ApiTestCase {
|
|||
],
|
||||
'comment' => 'Test for ApiComparePages',
|
||||
] );
|
||||
|
||||
Title::clearCaches(); // Otherwise it has the wrong latest revision for some reason
|
||||
}
|
||||
|
||||
protected function doReplacements( &$value ) {
|
||||
|
|
|
|||
|
|
@ -304,9 +304,4 @@ class LinkRendererTest extends MediaWikiLangTestCase {
|
|||
$linkRenderer->getLinkClasses( $redirectTitle )
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown(): void {
|
||||
Title::clearCaches();
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ class ExtraParserTest extends MediaWikiIntegrationTestCase {
|
|||
MainConfigNames::InterwikiCache,
|
||||
ClassicInterwikiLookup::buildCdbHash( $testInterwikis )
|
||||
);
|
||||
Title::clearCaches();
|
||||
|
||||
$this->parser->startExternalParse(
|
||||
Title::newFromText( __FUNCTION__ ),
|
||||
$this->options,
|
||||
|
|
|
|||
|
|
@ -168,9 +168,4 @@ class TitleMatcherTest extends MediaWikiIntegrationTestCase {
|
|||
$result = $matcher->getNearMatchResultSet( 'Test Link Wrong' );
|
||||
$this->assertSame( 0, $result->numRows() );
|
||||
}
|
||||
|
||||
protected function tearDown(): void {
|
||||
Title::clearCaches();
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ class TitleTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
protected function tearDown(): void {
|
||||
Title::clearCaches();
|
||||
parent::tearDown();
|
||||
// delete dummy pages
|
||||
$this->getNonexistingTestPage( 'UTest1' );
|
||||
|
|
|
|||
|
|
@ -52,11 +52,6 @@ class TitleUrlTest extends MediaWikiLangTestCase {
|
|||
] );
|
||||
}
|
||||
|
||||
protected function tearDown(): void {
|
||||
Title::clearCaches();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testUrlsForSimpleTitle() {
|
||||
$title = Title::makeTitle( NS_USER, 'Göatee' );
|
||||
$name = $title->getPrefixedURL();
|
||||
|
|
|
|||
Loading…
Reference in a new issue