Remove AuthManager::$instance and ::resetCache()

AuthManager has been converted to a service in 1.35.
AuthManager::$instance is only used in AuthManager::resetCache(),
where it is set to null.

This patch also removes AuthManager::resetCache() because with
removing AuthManager::$instance AuthManager::resetCache() has no
longer any effect.

Change-Id: I8b27f9a2d0d3f7acec6b93f64f9c256084990026
This commit is contained in:
Alexander Vorwerk 2021-06-20 14:32:02 +02:00
parent 4cdc36eaec
commit e77ebc1854
3 changed files with 0 additions and 20 deletions

View file

@ -133,9 +133,6 @@ class AuthManager implements LoggerAwareInterface {
/** Auto-creation is due to a Maintenance script */
public const AUTOCREATE_SOURCE_MAINT = '::Maintenance::';
/** @var AuthManager|null */
private static $instance = null;
/** @var WebRequest */
private $request;
@ -2472,21 +2469,6 @@ class AuthManager implements LoggerAwareInterface {
}
}
/**
* Reset the internal caching for unit testing
* @note Unit tests only
* @internal
*/
public static function resetCache() {
if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
// @codeCoverageIgnoreStart
throw new \MWException( __METHOD__ . ' may only be called from unit tests!' );
// @codeCoverageIgnoreEnd
}
self::$instance = null;
}
/**
* @return HookContainer
*/

View file

@ -645,7 +645,6 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
}
$wgRequest = RequestContext::getMain()->getRequest();
MediaWiki\Session\SessionManager::resetCache();
MediaWiki\Auth\AuthManager::resetCache();
// If anything changed the content language, we need to
// reset the SpecialPageFactory.

View file

@ -110,7 +110,6 @@ abstract class ApiTestCase extends MediaWikiLangTestCase {
$wgRequest = $this->buildFauxRequest( $params, $sessionObj );
RequestContext::getMain()->setRequest( $wgRequest );
RequestContext::getMain()->setAuthority( $performer );
MediaWiki\Auth\AuthManager::resetCache();
// set up local environment
$context = $this->apiContext->newTestContext( $wgRequest, $performer );