wiki.techinc.nl/tests/phpunit/includes
Thalia 5fffa5c07a Pass the user and request into BlockManager::getUserBlock
Blocks are checked from the User object. Specifically,
User::getBlockedStatus instantiates a BlockManager and calls
BlockManager::getUserBlock. However, checking the block often depends
on knowing more about the state than the User should know. As a result,
the global user and request objects were passed into the block manager
on construction.

Whether the global request object should be passed into a service
constructor is still up for debate, so this moves the check for the
global state back to User::getBlockedStatus for now. (Note that it
reintroduces the problem of the User knowing more about state than it
should.)

This change also makes clearer the cases in which
BlockManager::getUserBlock is called from the User.

Different blocks may be sought, depending on the user and their
permissions. The user may be:
(1) The global user (and can be affected by IP blocks). The global
    request object is needed for checking the IP address, the XFF
    header and the cookies.
(2) The global user (and exempt from IP blocks). The global request
    object is needed for checking the cookies.
(3) Another user (not the global user). No request object is available
    or needed; just look for a block against the user account.

Cases #1 and #2 check whether the global user is blocked in practice;
the block may due to their user account being blocked or to an IP
address block or cookie block (or multiple of these). Case #3 simply
checks whether a user's account is blocked, and does not determine
whether the person using that account is affected in practice by any
IP address or cookie blocks.

Bug: T231919
Change-Id: I3f51fd3579514b83b567dfe20926df2f0930dc85
2019-09-11 08:23:54 +01:00
..
actions Replace User::isAllowed with PermissionManager. 2019-08-20 14:43:51 -07:00
api Merge "ApiBase: Always validate that 'limit' is numeric" 2019-09-04 15:15:43 +00:00
auth Fix method/function names case mismatch in core files 2019-08-31 23:17:51 +00:00
block Pass the user and request into BlockManager::getUserBlock 2019-09-11 08:23:54 +01:00
cache Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
changes Move trivially compatible tests to the unit tests suite 2019-06-30 15:23:53 +02:00
changetags ChangeTags: turn private getPrevTags() into public getTags() 2019-08-07 15:19:20 +02:00
collation
config Test that classes use all their ServiceOptions 2019-08-19 20:42:28 +03:00
content Add UnknownContentHandler. 2019-08-29 10:43:11 +00:00
context
db rdbms: expand on LoadBalancer ownership concept 2019-09-05 12:08:13 -07:00
debug Load GlobalFunctions.php to tests/phpunit/bootstrap.php 2019-07-14 01:28:07 +02:00
deferred deferred: make DeferredUpdates::attemptUpdate() use callback owners for $fnameTrxOwner 2019-08-03 05:48:02 +00:00
diff phpunit: Repair GLOBALS reset in MediaWikiUnitTestCase 2019-09-02 20:58:34 +01:00
editpage
exception Move trivially compatible tests to the unit tests suite 2019-06-30 15:23:53 +02:00
externalstore externalstore: unbreak writes to non-default storage clusters due to isReadOnly() 2019-07-16 22:08:00 -07:00
filebackend filebackend: optimize 'move' in FSFileBackend to avoid is_file() calls 2019-09-07 15:18:43 -07:00
filerepo LocalRepo: Remove leading 0 from 32-byte SHA1 keys 2019-09-03 16:04:14 +02:00
GlobalFunctions Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
htmlform Load GlobalFunctions.php to tests/phpunit/bootstrap.php 2019-07-14 01:28:07 +02:00
http Split HttpTest and SessionTest to unit and integration 2019-07-13 21:01:09 +02:00
import Include change tags in revision import structure 2019-09-03 21:14:16 +02:00
interwiki Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
jobqueue Various fixes and simplifications to RefreshLinksJob::runTitle() 2019-07-11 06:06:02 +00:00
language language: Move ConverterRule to includes/ and add test case 2019-08-26 12:32:14 +01:00
libs Merge "libs/Message: Improve documentation" 2019-09-06 01:45:24 +00:00
linkeddata
linker objectcache: Hard deprecate ObjectCache::getMainWANInstance() 2019-07-09 09:29:57 +00:00
logging Revert "Make LocalisationCache a service" 2019-08-26 18:28:26 +02:00
mail
media phpunit: Repair GLOBALS reset in MediaWikiUnitTestCase 2019-09-02 20:58:34 +01:00
Message lib/Message: Support MessageValue as a parameter 2019-08-30 15:14:37 -04:00
Navigation
objectcache Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
page Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
pager
parser phpunit: Repair GLOBALS reset in MediaWikiUnitTestCase 2019-09-02 20:58:34 +01:00
password Remove hard deprecation of PasswordPolicyChecks::checkPopularPasswordBlacklist 2019-08-27 17:53:27 +01:00
Permissions Merge "Move User::getAllRights to PermissionManager." 2019-08-29 21:00:23 +00:00
poolcounter
preferences Test that classes use all their ServiceOptions 2019-08-19 20:42:28 +03:00
rcfeed Clear test user registry between tests 2019-08-14 10:27:21 +03:00
registration registration: Avoid redundant LBYL check in ExtensionRegistry::queue() 2019-09-01 18:28:41 +00:00
resourceloader Merge "resourceloader: Compile documentElement.className server-side" 2019-09-03 21:04:23 +00:00
Rest rest: Use ParamValidator library, add BodyValidator 2019-09-04 10:12:35 -04:00
Revision Introduce RevisionStore::newRevisionsFromBatch 2019-09-03 12:23:01 -07:00
search Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
session objectcache: add MediumSpecificBagOStuff base class for non-proxy subclasses 2019-07-19 13:01:46 -07:00
shell Load GlobalFunctions.php to tests/phpunit/bootstrap.php 2019-07-14 01:28:07 +02:00
site phpunit: Repair GLOBALS reset in MediaWikiUnitTestCase 2019-09-02 20:58:34 +01:00
skins Move trivially compatible tests to the unit tests suite 2019-06-30 15:23:53 +02:00
sparql
specialpage Support the creation of special pages with services injected 2019-09-08 12:57:54 +02:00
specials Merge "Rework ApiUploadTest" 2019-09-02 16:54:56 +00:00
Storage Introduce BlobStore::getBlobBatch method 2019-08-30 09:40:49 +00:00
title Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
upload
user Pass the user and request into BlockManager::getUserBlock 2019-09-11 08:23:54 +01:00
utils phpunit: Repair GLOBALS reset in MediaWikiUnitTestCase 2019-09-02 20:58:34 +01:00
watcheditem createNoOpMock() method for PHPUnit tests 2019-08-29 18:00:37 +03:00
ActorMigrationTest.php Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
AutoLoaderTest.php
AutopromoteTest.php
CategoryTest.php
CommentStoreCommentTest.php
CommentStoreTest.php
CommentStoreTest.sql
ContentSecurityPolicyTest.php Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
DeprecatedGlobalTest.php
DiffHistoryBlobTest.php
EditPageTest.php
ExportTest.php
ExtraParserTest.php
FauxRequestTest.php
GitInfoTest.php
HooksTest.php
HtmlTest.php Don't process "all" option in Html::namespaceSelectorOptions 2019-07-04 10:17:59 +02:00
LinkerTest.php
LinkFilterTest.php
ListToggleTest.php
MagicWordFactoryTest.php
MediaWikiServicesTest.php
MediaWikiTest.php
MediaWikiVersionFetcherTest.php Unset all globals unneeded for unit tests, assert correct directory 2019-07-09 14:09:29 -04:00
MergeHistoryTest.php Don't use new MCR schema without using DB 2019-08-13 17:05:24 +03:00
MessageTest.php Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
MovePageTest.php Merge "createNoOpMock() method for PHPUnit tests" 2019-08-29 18:15:43 +00:00
MultiHttpClientTest.php
MWTimestampTest.php
OutputPageTest.php resourceloader: Reduce width of module hash from 7 chars to 5 2019-09-02 01:25:48 +00:00
PagePropsTest.php
PrefixSearchTest.php Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
ReadOnlyModeTest.php
RevisionDbTestBase.php Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
RevisionMcrDbTest.php
RevisionMcrReadNewDbTest.php
RevisionMcrWriteBothDbTest.php
RevisionNoContentModelDbTest.php
RevisionPreMcrDbTest.php
RevisionTest.php Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
RevisionTestModifyableContent.php
RevisionTestModifyableContentHandler.php
SampleTest.php Replace old URLs in SampleTest 2019-07-10 15:00:12 +01:00
SiteStatsTest.php
StatusTest.php
SystemBlockTest.php
TemplateCategoriesTest.php Re-apply: Factors out permissions check from User into PermissionManager service 2019-06-28 13:19:38 -07:00
TemplateParserTest.php
TestLogger.php
TestUser.php Drop last bits of oracle 2019-08-14 23:44:22 +02:00
TestUserRegistry.php
TimeAdjustTest.php
TitleMethodsTest.php
TitlePermissionTest.php Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
TitleTest.php Remove unneeded overrideMwServices/resetServices 2019-08-29 14:26:18 +03:00
WebRequestTest.php
WikiMapTest.php Removed deprecated WikiMap::getWikiIdFromDomain() method 2019-07-14 01:17:31 +01:00
WikiReferenceTest.php phpunit: Repair GLOBALS reset in MediaWikiUnitTestCase 2019-09-02 20:58:34 +01:00
XmlTest.php