Convert WatchedItem and friends to UserIdentity
authorAryeh Gregor <ayg@aryeh.name>
Sun, 28 Apr 2019 11:07:18 +0000 (14:07 +0300)
committerAryeh Gregor <ayg@aryeh.name>
Sun, 5 May 2019 11:35:52 +0000 (14:35 +0300)
commitf7201e3b9b8117582bdd29c52b0a8c637650fbc9
tree0ea9551f055d960f1599fd61fde23a09b22db55d
parent795bbed0ec53b7ab5f338b396a9e46a0fb031365
Convert WatchedItem and friends to UserIdentity

I wasn't able to port some places that rely on isAllowed, getOption, or
related methods.

This adds isRegistered() to UserIdentity, which works like
User::isLoggedIn() but with a better name.

I also cleaned up User mocks in WatchedItemQueryServiceUnitTest in the
course of debugging test failures when switching them to
UserIdentityValue instead of mock Users where possible. They now specify
explicitly which methods are allowed to be called on their User objects,
which I believe is good practice for mocks (and unfortunately PHPUnit
makes it awkward).

Bug: T207972
Depends-On: I883d506197a011fe4c102b72df4d9deb58ab5ca2
Change-Id: Iadbf7bc31a496899dbef44e49065ff89f37aea89
16 files changed:
RELEASE-NOTES-1.34
includes/jobqueue/jobs/ClearUserWatchlistJob.php
includes/user/User.php
includes/user/UserIdentity.php
includes/user/UserIdentityValue.php
includes/watcheditem/NoWriteWatchedItemStore.php
includes/watcheditem/WatchedItem.php
includes/watcheditem/WatchedItemQueryService.php
includes/watcheditem/WatchedItemQueryServiceExtension.php
includes/watcheditem/WatchedItemStore.php
includes/watcheditem/WatchedItemStoreInterface.php
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/user/UserTest.php
tests/phpunit/includes/watcheditem/NoWriteWatchedItemStoreUnitTest.php
tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php
tests/phpunit/includes/watcheditem/WatchedItemStoreUnitTest.php