A single test function can have multiple @dataProviders. No problem.
A @dataProvider can also be used by multiple test functions. No
problem. No need to duplicate such large pieces of code when it's
identical anyway.
Change-Id: I5aea36304ec2d1666ff2334ba883df07a70c15c5
If the namespace configuration changed, it’s possible that the title in
the params can no longer be parsed. In that case, we shouldn’t return a
null entry, but just an empty array instead. (I haven’t tried it out
locally, but the test suggests that the actual formatting of the row
works without issue, with the title being shown as Special:BadTitle.)
Bug: T370396
Change-Id: I6335e12efa518332f7cd2268a833f8b60b8e6abe
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: Iae45fa269363be8ee05c598ea6926514ce817762
This patch introduces a namespace declaration for the
MediaWiki\RCFeed to IRCColourfulRCFeedFormatter and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I78061ed136208f974e864a9622264409979ba120
Use StatsFactory for emitting metrics from PageStore and add assertions
for the new metrics.
Bug: T359374
Change-Id: Id099f54eb79a2dce078259cf9c13e548c1ec56f2
`CheckUserPrivateEventLogFormatterTest::testLogDatabaseRows()` calls
`LogFormatterTestCase::doTestLogFormatter()` which overrides UserFactory
with a mock which will eventually call `BlockManager::getBlock()` which
tries to create a legacy user object with `newFromUserIdentity()`, but
the overriden UserFactory mock doesn't mock the method `newFromUserIdentity()`,
so will return a NULL user object.
With the NULL user object returned above and CentralAuth enabled, the
`onGetUserBlock()` hook in CA will fire and try to act on a NULL user object
causing the `CentralAuthUser::getInstanceByName()` method in I2c7b4ceb56463e88
to throw as if we're dealing with a user object having an invalid username.
In order to fix this, this patch also mocks the `newFromUserIdentity()` method
in the mocked UserFactory service that gets overridden in test. As a result,
with this patch, the failing tests in CheckUser extension should begin
passing again.
Bug: T343963
Change-Id: I11937d0d53b3914d7f6bd1483404a04b74ac26c9
Changes to the use statements done automatically via script
Addition of missing use statements and changes to docs done manually
Change-Id: Ib326ae1e5c8409a98398c721e8b8ce42c73bd012
Support migration stages when reading and writing blocks.
I tried to set it up for an easy next stage, in which support for the
old schema is removed. I tried to avoid factoring out of shared code
between the two schemas, so that the old schema cases can simply be
deleted without the need to revert unnecessary abstractions.
However, I added HideUserUtils to factor out ipb_deleted queries. Code
review showed that this was already quite complex, with multiple
approaches to the problem, so it benefits from refactoring even without
the schema abstraction.
HideUserUtils is a service rather than a standalone class to support
unit tests, since unit tests do not allow global config access. When
the migration stage config is removed, it will be a service with no
constructor parameters -- an unnecessary abstraction which should
ideally be resolved at that time.
When interpreting result rows, it is possible to share code by using
field aliases. But when constructing WHERE conditions, the actual field
names need to be used, so the migration is more intrusive in
ApiQueryBlocks and SpecialBlockList, where complex conditions are used.
Bug: T346293
Bug: T51504
Bug: T349883
Change-Id: I408acf7a57b0100fe18c455fc13141277a598925
Why:
* The DatabaseLogEntry::newFromId method only uses the provided DB
for SELECT queries (via the DatabaseLogEntry
::newSelectQueryBuilder method).
* The DatabaseLogEntry::newSelectQueryBuilder method takes a
IReadableDatabase object and this is the only usage of the DB
provided to ::newFromId
* As such, the ::newFromId type should be IReadableDatabase
instead of IDatabase so that callers who only have a readable
database connection can still use this method.
What:
* Change the type of the $db parameter of DatabaseLogEntry
::newFromId to be a IReadableDatabase instead of an IDatabase.
* Update RCDatabaseLogEntry::newFromId to reflect the change
in parameter type.
* Update the associated tests to use a IReadableDatabase.
Change-Id: Idc6c13b147a5ff99d0969c1120eb1deb2d111496
To replace DatabaseLogEntry::getSelectQueryData()
Many migrations can't happen right now because of use of
ChangeTagsStore::modifyDisplayQuery() but I will fix that soon.
Bug: T344971
Change-Id: Iafb2bb5ea3a0da49da1dafb69b65dea3c15029ed
Mock the needed services, or set fixed values to avoid DB lookups, when
possible. Add the test to the Database group otherwise, e.g. for things
like Skin and Parser that use global state all over the place.
Change-Id: I8d87013d89accaf04d0ac19cb4b7216290383eb5
LogFormatter is another place that uses the global state a lot, with
Title, Linker, etc. Some of its dependencies were accessing the
database, but most LogFormatter methods are not in the database group.
This patch tries to work around the DB dependencies by providing
(complex) mocks that do not access the DB. There's a lot of mocking
involved, but that's just because of the current state of LogFormatter,
and hopefully it'll get better some day.
Rights- and ProtectLogFormatter also need a mock DB connection because
they use the database to format expiry.
Bug: T155147
Change-Id: I4fa9ee4fb246e08cb2b4577454029b5af3276b79
Just methods where adding "static" to the declaration was enough, I
didn't do anything with providers that used $this.
Initially by search and replace. There were many mistakes which I
found mostly by running the PHPStorm inspection which searches for
$this usage in a static method. Later I used the PHPStorm "make static"
action which avoids the more obvious mistakes.
Bug: T332865
Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
Similiar to the handling for suppressed edits since b6f148b
Bug: T327538
Follow-Up: I08f14f712479e1b170c606e2b64857f8386acd76
Change-Id: Icfb46d9ef02984510ef1c2c5e4785345cbe6ad2f
Since the introduction of the new hooks stystem, it is not possible to
clear all hooks by setting $wgHooks. This would only clear old-style
hooks. This is becoming increasingly problematic as the new hooks system
is adopted by more and more extensions.
Introduce a method that allows tests to reset many or all hooks.
This isn't needed much in core, but extension tests need it.
Change-Id: Ica3eb88fe23fe822d2aadb96ff5d15f80dce0d7b
Also, make use of MainConfigNames constants where necessary like in
HashConfig map.
NOTE: Since `wgConf` is not a setting, keep using `setMwGlobals()`
in this case.
Change-Id: I8d0c718fd02043835fe122d675cce3d759b30330
This allows the API to consistently return the new value for old rows.
Bug: T241709
Follow-Up: I36f49dc83718cc78f17fc340e6445030b8fd0c66
Change-Id: Ida69980f62a6ef070ba41b7e826967f424881716
The column is now unused. It was used to prefill edit count in User
object before 83e1846 by use of User::newFromRow
Follow-Up: I1b78bad7e1fa43f5f82908567a7daad9c6cc79b9
Change-Id: Iec5eeaa8729a3add46c11cd62dee8aefe2e5e050
The i18n part of T20361 / ec0dd5b adds new log parameter,
logs from before the changes are needed to work with the formatter.
Bug: T289806
Change-Id: I096bc14373cbe038671fc33f651af7e005998a3b