diff options
author | Cindy Cicalese <cindom@gmail.com> | 2021-04-12 20:43:46 -0400 |
---|---|---|
committer | Cicalese <ccicalese@wikimedia.org> | 2021-04-21 02:48:31 +0000 |
commit | ce6a4ef45e623c248b29ece228bb72e7fc27f51a (patch) | |
tree | 83bcb4ba2be02bb40c0c11bb0e280a755362fad3 /tests/phpunit/includes | |
parent | f8ed11e1705137da7077ad9d2045f4ccd9ed4e06 (diff) | |
download | mediawikicore-ce6a4ef45e623c248b29ece228bb72e7fc27f51a.tar.gz mediawikicore-ce6a4ef45e623c248b29ece228bb72e7fc27f51a.zip |
Use WatchlistManager in auth classes
Change-Id: Ib8d338bc0b167277f36ab6c5d45c98c35e4a9ba9
Diffstat (limited to 'tests/phpunit/includes')
7 files changed, 23 insertions, 8 deletions
diff --git a/tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php index c2afed08668d..6ee49f3e7b68 100644 --- a/tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php @@ -132,7 +132,8 @@ class AbstractPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegr $services->getReadOnlyMode(), $services->getUserNameUtils(), $services->getBlockManager(), - $services->getBlockErrorFormatter() + $services->getBlockErrorFormatter(), + $services->getWatchlistManager() ); $provider = $this->getMockForAbstractClass( diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php b/tests/phpunit/includes/auth/AuthManagerTest.php index ecf400d7d846..6b42b1347a01 100644 --- a/tests/phpunit/includes/auth/AuthManagerTest.php +++ b/tests/phpunit/includes/auth/AuthManagerTest.php @@ -16,6 +16,7 @@ use MediaWiki\MediaWikiServices; use MediaWiki\Session\SessionInfo; use MediaWiki\Session\UserInfo; use MediaWiki\User\UserNameUtils; +use MediaWiki\Watchlist\WatchlistManager; use PHPUnit\Framework\Assert; use PHPUnit\Framework\MockObject\Builder\InvocationMocker; use PHPUnit\Framework\MockObject\Rule\InvocationOrder; @@ -70,6 +71,9 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase { /** @var BlockErrorFormatter */ private $blockErrorFormatter; + /** @var WatchlistManager */ + private $watchlistManager; + /** * Sets a mock on a hook * @param string $hook @@ -189,6 +193,9 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase { if ( $regen || !$this->blockErrorFormatter ) { $this->blockErrorFormatter = MediaWikiServices::getInstance()->getBlockErrorFormatter(); } + if ( $regen || !$this->watchlistManager ) { + $this->watchlistManager = MediaWikiServices::getInstance()->getWatchlistManager(); + } if ( $regen || !$this->hookContainer ) { // Set up a HookContainer similar to the normal one except that it // gets global hooks from $this->authHooks instead of $wgHooks @@ -226,7 +233,8 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase { $this->readOnlyMode, $this->userNameUtils, $this->blockManager, - $this->blockErrorFormatter + $this->blockErrorFormatter, + $this->watchlistManager ); $this->manager->setLogger( $this->logger ); $this->managerPriv = TestingAccessWrapper::newFromObject( $this->manager ); diff --git a/tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php index 8fc1778b3746..a0c02c1c29a7 100644 --- a/tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php @@ -146,7 +146,8 @@ class ConfirmLinkSecondaryAuthenticationProviderTest extends \MediaWikiIntegrati $mwServices->getReadOnlyMode(), $this->createNoOpMock( UserNameUtils::class ), $mwServices->getBlockManager(), - $mwServices->getBlockErrorFormatter() + $mwServices->getBlockErrorFormatter(), + $mwServices->getWatchlistManager() ] ) ->getMock(); $manager->expects( $this->any() )->method( 'allowsAuthenticationDataChange' ) @@ -251,7 +252,8 @@ class ConfirmLinkSecondaryAuthenticationProviderTest extends \MediaWikiIntegrati $readOnlyMode, $userNameUtils, $mwServices->getBlockManager(), - $mwServices->getBlockErrorFormatter() + $mwServices->getBlockErrorFormatter(), + $mwServices->getWatchlistManager() ); $provider->setManager( $manager ); $provider = TestingAccessWrapper::newFromObject( $provider ); diff --git a/tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php index f5ba18cf0644..50363243bdf7 100644 --- a/tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php @@ -75,7 +75,8 @@ class EmailNotificationSecondaryAuthenticationProviderTest extends \MediaWikiInt $mwServices->getReadOnlyMode(), $userNameUtils, $mwServices->getBlockManager(), - $mwServices->getBlockErrorFormatter() + $mwServices->getBlockErrorFormatter(), + $mwServices->getWatchlistManager() ); $creator = $this->getMockBuilder( \User::class )->getMock(); diff --git a/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php index dd8aa58b1b33..0fc39b9e7c97 100644 --- a/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php @@ -54,7 +54,8 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegrati $mwServices->getReadOnlyMode(), $userNameUtils, $mwServices->getBlockManager(), - $mwServices->getBlockErrorFormatter() + $mwServices->getBlockErrorFormatter(), + $mwServices->getWatchlistManager() ); } $this->validity = \Status::newGood(); diff --git a/tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php index 663f48eb9901..05d58caeff9c 100644 --- a/tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php @@ -103,7 +103,8 @@ class ResetPasswordSecondaryAuthenticationProviderTest extends \MediaWikiIntegra $mwServices->getReadOnlyMode(), $userNameUtils, $mwServices->getBlockManager(), - $mwServices->getBlockErrorFormatter() + $mwServices->getBlockErrorFormatter(), + $mwServices->getWatchlistManager() ); $provider->setManager( $manager ); $provider = TestingAccessWrapper::newFromObject( $provider ); diff --git a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php index 165f476e0d1f..d061f2839e96 100644 --- a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php @@ -54,7 +54,8 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg $mwServices->getReadOnlyMode(), $userNameUtils, $mwServices->getBlockManager(), - $mwServices->getBlockErrorFormatter() + $mwServices->getBlockErrorFormatter(), + $mwServices->getWatchlistManager() ); } $this->validity = \Status::newGood(); |