diff options
author | Alexander Vorwerk <alexander.vorwerk@stud.uni-goettingen.de> | 2022-01-12 21:13:39 +0100 |
---|---|---|
committer | Alexander Vorwerk <alexander.vorwerk@stud.uni-goettingen.de> | 2022-01-27 22:04:16 +0100 |
commit | decbaf4f384cd53912c0d21762b2b64309cb30f0 (patch) | |
tree | d9716312fc58ed176ad02c2860005e523c275d75 /tests/phpunit/includes/session | |
parent | e05dde5bc4bcfa5b636272978ff9be5100aebe94 (diff) | |
download | mediawikicore-decbaf4f384cd53912c0d21762b2b64309cb30f0.tar.gz mediawikicore-decbaf4f384cd53912c0d21762b2b64309cb30f0.zip |
phpunit: use ->getServiceContainer() in integration tests
Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
Diffstat (limited to 'tests/phpunit/includes/session')
4 files changed, 4 insertions, 8 deletions
diff --git a/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php b/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php index f7f0165c1bc1..6fd99fdb104a 100644 --- a/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php +++ b/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php @@ -2,7 +2,6 @@ namespace MediaWiki\Session; -use MediaWiki\MediaWikiServices; use MediaWikiIntegrationTestCase; use MultiConfig; use Psr\Log\LogLevel; @@ -67,7 +66,7 @@ class BotPasswordSessionProviderTest extends MediaWikiIntegrationTestCase { } public function addDBDataOnce() { - $passwordFactory = MediaWikiServices::getInstance()->getPasswordFactory(); + $passwordFactory = $this->getServiceContainer()->getPasswordFactory(); $passwordHash = $passwordFactory->newFromPlaintext( 'foobaz' ); $sysop = static::getTestSysop()->getUser(); diff --git a/tests/phpunit/includes/session/CookieSessionProviderTest.php b/tests/phpunit/includes/session/CookieSessionProviderTest.php index f3b860c1638b..0b40c2064963 100644 --- a/tests/phpunit/includes/session/CookieSessionProviderTest.php +++ b/tests/phpunit/includes/session/CookieSessionProviderTest.php @@ -3,7 +3,6 @@ namespace MediaWiki\Session; use MediaWiki\HookContainer\HookContainer; -use MediaWiki\MediaWikiServices; use MediaWikiIntegrationTestCase; use Psr\Log\LogLevel; use Psr\Log\NullLogger; @@ -39,7 +38,7 @@ class CookieSessionProviderTest extends MediaWikiIntegrationTestCase { */ private function getHookContainer() { // Need a real HookContainer for testPersistSession() which modifies $wgHooks - return MediaWikiServices::getInstance()->getHookContainer(); + return $this->getServiceContainer()->getHookContainer(); } /** diff --git a/tests/phpunit/includes/session/SessionBackendTest.php b/tests/phpunit/includes/session/SessionBackendTest.php index e1a17cedae9e..51deab717e9a 100644 --- a/tests/phpunit/includes/session/SessionBackendTest.php +++ b/tests/phpunit/includes/session/SessionBackendTest.php @@ -4,7 +4,6 @@ namespace MediaWiki\Session; use Config; use MediaWiki\HookContainer\HookContainer; -use MediaWiki\MediaWikiServices; use MediaWikiIntegrationTestCase; use User; use Wikimedia\AtEase\AtEase; @@ -39,7 +38,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase { */ private function getHookContainer() { // Need a real HookContainer to support modification of $wgHooks in the test - return MediaWikiServices::getInstance()->getHookContainer(); + return $this->getServiceContainer()->getHookContainer(); } /** diff --git a/tests/phpunit/includes/session/SessionProviderTest.php b/tests/phpunit/includes/session/SessionProviderTest.php index e17355bb3866..8b151e83122b 100644 --- a/tests/phpunit/includes/session/SessionProviderTest.php +++ b/tests/phpunit/includes/session/SessionProviderTest.php @@ -2,7 +2,6 @@ namespace MediaWiki\Session; -use MediaWiki\MediaWikiServices; use MediaWiki\User\UserNameUtils; use MediaWikiIntegrationTestCase; use TestLogger; @@ -203,7 +202,7 @@ class SessionProviderTest extends MediaWikiIntegrationTestCase { $this->assertSame( 'MockSessionProvider sessions', $provider->describe( - MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' ) ) + $this->getServiceContainer()->getLanguageFactory()->getLanguage( 'en' ) ) ); } |