diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2024-09-05 23:45:54 +0200 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2024-09-05 23:47:16 +0200 |
commit | 5d5a9764550b2ba90f906a00ac301a8b0d7dce9b (patch) | |
tree | 5eb4943046f68f972e6970740224a7120ff17970 | |
parent | d6f944ffd5ca16f80ba86b3b84e0f25852df971b (diff) | |
download | mediawikicore-5d5a9764550b2ba90f906a00ac301a8b0d7dce9b.tar.gz mediawikicore-5d5a9764550b2ba90f906a00ac301a8b0d7dce9b.zip |
tests: Remove reset of services in tests
Before a test is started there are no services, there is no need to
reset services in setUp().
After a test finished all created services are destroyed by
MediaWikiIntegrationTestCase and does not need own teardown.
overrideConfigValue() also resets services
Change-Id: I41c71866ec6d93cd2b7e3dd45269e0972ed6a273
5 files changed, 0 insertions, 26 deletions
diff --git a/tests/phpunit/includes/content/WikitextContentHandlerIntegrationTest.php b/tests/phpunit/includes/content/WikitextContentHandlerIntegrationTest.php index b3e1dfdbf6b9..21ce0439e0d6 100644 --- a/tests/phpunit/includes/content/WikitextContentHandlerIntegrationTest.php +++ b/tests/phpunit/includes/content/WikitextContentHandlerIntegrationTest.php @@ -39,7 +39,6 @@ class WikitextContentHandlerIntegrationTest extends TextContentHandlerIntegratio ] + $defaults, ] ) ); - $this->getServiceContainer()->resetServiceForTesting( 'InterwikiLookup' ); } public static function provideGetParserOutput() { @@ -259,9 +258,6 @@ class WikitextContentHandlerIntegrationTest extends TextContentHandlerIntegratio * @param string $expectedTarget Expected target string in the HTML redirect */ public function testMakeRedirectContent( LinkTarget $target, string $expectedWT, string $expectedTarget ) { - $this->getServiceContainer()->resetServiceForTesting( 'ContentLanguage' ); - $this->getServiceContainer()->resetServiceForTesting( 'MagicWordFactory' ); - $handler = $this->getServiceContainer()->getContentHandlerFactory() ->getContentHandler( CONTENT_MODEL_WIKITEXT ); $content = $handler->makeRedirectContent( Title::newFromLinkTarget( $target ) ); diff --git a/tests/phpunit/includes/deferred/LinksUpdateTest.php b/tests/phpunit/includes/deferred/LinksUpdateTest.php index d5ecee9e5fb0..8247d26afc8c 100644 --- a/tests/phpunit/includes/deferred/LinksUpdateTest.php +++ b/tests/phpunit/includes/deferred/LinksUpdateTest.php @@ -56,12 +56,6 @@ class LinksUpdateTest extends MediaWikiLangTestCase { ClassicInterwikiLookup::buildCdbHash( $testInterwikis, $GLOBAL_SCOPE ), MainConfigNames::RCWatchCategoryMembership => true, ] ); - // Reset title services after interwiki prefixes change - $services = MediaWikiServices::getInstance(); - $services->resetServiceForTesting( 'InterwikiLookup' ); - $services->resetServiceForTesting( '_MediaWikiTitleCodec' ); - $services->resetServiceForTesting( 'TitleFormatter' ); - $services->resetServiceForTesting( 'TitleParser' ); } public function addDBDataOnce() { diff --git a/tests/phpunit/includes/editpage/PreloadedContentBuilderTest.php b/tests/phpunit/includes/editpage/PreloadedContentBuilderTest.php index 0272fa822aee..7d65bec146a0 100644 --- a/tests/phpunit/includes/editpage/PreloadedContentBuilderTest.php +++ b/tests/phpunit/includes/editpage/PreloadedContentBuilderTest.php @@ -22,7 +22,6 @@ class PreloadedContentBuilderTest extends MediaWikiIntegrationTestCase { // Needed for the 'Default preload section' test case due to use of wfMessage() $this->overrideConfigValue( MainConfigNames::UseDatabaseMessages, true ); - $services->resetServiceForTesting( 'MessageCache' ); $this->preloadedContentBuilder = $services->getPreloadedContentBuilder(); } diff --git a/tests/phpunit/includes/logging/DatabaseLogEntryTest.php b/tests/phpunit/includes/logging/DatabaseLogEntryTest.php index 3e1aea3b2830..4ff0a2e50d70 100644 --- a/tests/phpunit/includes/logging/DatabaseLogEntryTest.php +++ b/tests/phpunit/includes/logging/DatabaseLogEntryTest.php @@ -9,19 +9,6 @@ use Wikimedia\Rdbms\IReadableDatabase; * @group Database */ class DatabaseLogEntryTest extends MediaWikiIntegrationTestCase { - protected function setUp(): void { - parent::setUp(); - - // These services cache their joins - $this->getServiceContainer()->resetServiceForTesting( 'CommentStore' ); - $this->getServiceContainer()->resetServiceForTesting( 'ActorMigration' ); - } - - protected function tearDown(): void { - $this->getServiceContainer()->resetServiceForTesting( 'CommentStore' ); - $this->getServiceContainer()->resetServiceForTesting( 'ActorMigration' ); - parent::tearDown(); - } /** * @covers \DatabaseLogEntry::newFromId diff --git a/tests/phpunit/includes/parser/ExtraParserTest.php b/tests/phpunit/includes/parser/ExtraParserTest.php index 7d9b2b2514c1..c6ad8220abf1 100644 --- a/tests/phpunit/includes/parser/ExtraParserTest.php +++ b/tests/phpunit/includes/parser/ExtraParserTest.php @@ -41,8 +41,6 @@ class ExtraParserTest extends MediaWikiIntegrationTestCase { // FIXME: This test should pass without setting global content language $this->options = ParserOptions::newFromUserAndLang( new User, $contLang ); $this->options->setTemplateCallback( [ __CLASS__, 'statelessFetchTemplate' ] ); - $services->resetServiceForTesting( 'MagicWordFactory' ); - $services->resetServiceForTesting( 'ParserFactory' ); $this->parser = $services->getParserFactory()->create(); } |