* Turn normalize data into an autoloadable class and use the class name
as key instead of a partial file name with a base directory.
* This protected function is not aimed at re-use in extensions,
has no other usage known to Codesearch. Mark it internal,
and remove the compat introduced by 31283f34bf.
* Update the now ten-year-old documentation comments that described
this as "Temporary". The functionality and comment were introduced
in 2010 by Tim with r60599 (ad19c032b0).
Ref <https://bash.toolforge.org/search?p=0&q=temporary>.
* Replace the broken wikitech-l archive link with a working one,
and describe the thread for easier future reference.
Bug: T225756
Change-Id: I004da1f25c19e1095d0917349f2ba8461f9f0715
The abstract function gets validated with a new version of codesniffer
(since I4a17c2d965c277e7f8862e0e98228839022e0a01),
suppress the new error for the future version
Change-Id: I48c9151d24306822113c0305133a4984a8391f02
Changes from patch set Icb93c79f4843b59dae80d3eda1a880457a1a68f2
Also some swaps from assertEquals to assertSame/True/False/Null
Change-Id: Ife497ae6cb1888b77eb25e85b76df72adc65641a
The use case is to change action=edit into action=view in some
scenarios where we want to offer a more limited interface or a
gentler introduction to editing than MediaWiki provides, for example
I2e7b2682da7beb3c1c469bb784a9a8ec3998aeb9 in DiscussionTools.
Bug: T282204
Change-Id: Ib9302e2fda7dadf1edc43c0107db7234eb4bdf7a
UserGroupManagerFactory takes care of getting the
correct JobQueueGroup for the domain.
Bug: T287808
Change-Id: I548f0c52b298bfcae386ca1a427521c81dc802fe
Instead of trying to figure out the name based on the
context, which duplicates the handling in ActionFactory,
make use of ObjectFactory specs' `args` feature to inject
the name.
Also inject the SpecialPageFactory service.
Bug: T253078
Change-Id: Iec223583f93d45184152862d9eee735737453417
$wgActions used to map string action names to true,
false, a string, a callable, or an object. Now it can also
be an array (that isn't a callable) corresponding to an
ObjectFactory spec for DI.
This patch converts the revisiondelete and rollback actions to
use DI, with the rest to be converted later. The new structure
of $wgActions is fully backwards-compatible.
We don't yet deprecate Action::factory(), ::getActionName(),
and ::exists(), those will be deprecated in a follow-up.
Additionally, we no longer impose a rule that only some
actions can be overridden on a per-article basis via
Article::getActionOverrides().
Bug: T253078
Change-Id: I0fc3c53d671eced1758458f9a0148180b40c6c9b
Merge as another case in provideGetCanonical now that we don't
need separate configuration because 'interwiki' is configured as an
interwiki prefix for all of the tests.
Follow-up: I3b54909e33e69fea8bb5ec55c99848c196859185
Change-Id: I5cc358be8a4f037d4bf336aeecc6fa1b157aeeb6
Possible now that we can tell the service to throw mock
exceptions. Requires telling DummyServicesTrait to
include "Image" and "Image talk" alias support (these
are included in MessagesEn.php and so always available).
Follow-up: I11ae4c6292465626ad1e432f7c6e9754c8ef36c2
Change-Id: Ic995aeebcd2b9c8d2c43cb17258363eef81429ad
Before MovePageTest was skipped if the move was valid,
claiming we can't test actual moves. Now we can.
Additionally, use MediaTestTrait for file and repo
mocking.
Change-Id: Ie8a1edbdb2f22432919f03a60c2dacc5d4528615
Allows us to reduce direct mocking in individual tests, or relying
on MediaWikiServices, by having a reusable service instead that
can be used in unit tests.
Make use of it in a few places.
This dummy service is also less coupled to individual tests;
in the rest handler tests, replacing mocks that report that
only a specific string is an ip address with the actual implementation
that accepts other ip address, and in BlockUtilsTest use
an actually invalid user name instead of making the mock
UserNameUtils complain about a perfectly valid name.
Change-Id: Iaa3195002ac4ae7e0c9c58ed57c80c02762d4070
MediaWikiTitleCodec can throw MalformedTitleException,
which cannot be created in unit tests (see T281935). Until
that changes, add a helper callback
MediaWikiTitleCodec::$createMalformedTitleException
that will by default return a MalformedTitleException, but
tests can override this to return a mock.
We add this as an option to DummyServicesTrait to throw
generic `MalformedTitleException`s without regard to the
specifics of the message or parameters provided, this
can be used if no finer control is needed, or callers
can manually change the callback.
Demonstrate using it by moving the tests for UserNameUtils
to be unit tests - the only thing blocking this was the
creation of `MalformedTitleException`s.
Change-Id: I11ae4c6292465626ad1e432f7c6e9754c8ef36c2
Note: this contains a b/c incompatible change to
SlotRoleHandler, but it's never used in any extensions
and never was used.
Change-Id: I898ab18467f7f8c605a579cc6236859b9d86c7f5
Mock the UserIdentityLookup (might be worth adding
to DummyServicesTrait soon) and pass UserIdentityValue
instead of full User objects.
The tests for the factory methods are removed, those
just wrap around CentralIdLookupFactory which has
its own tests already.
Change-Id: Ieea548aae46e3dd5a71518e7381dd40ce19c94ec
Additionally it switches the query from DB_PRIMARY to DB_REPLICA.
I understand the idea with a quick revert, but I do not think
it can be that quick - to revert a newest revision of a page,
an editor or a bot needs to actually read it first, and reads
come from a replica. So we know at least some replicas already
had the latest revision showing to the user. Very likely by the
time revert is made, we'd have it in all replicas. If not - oh well,
we can't be perfect. But we shouldn't really do such a query on
primary - it's too heavy.
Change-Id: I2fae8dbe5f19635f4d99e26242e3b08ddad8f8af
Requires a bit of manual manipulation of globals, but
other than than no reason to make an integration test.
Change-Id: I56342770f856092992660e104e06aa65a24e0e20
Plus, fix implementation of
NoWriteWatchedItemStore::countWatchersMultiple, which
should call the same method on the actual store
A follow-up will convert to using data providers
to further reduce duplication
Change-Id: I82682c37b404110e1537aec8ca859044953a0f0a
MediaWikiTestCaseTrait provides a helper method,
createNoOpMock, that covers the case of wanting
to assert that no methods or no methods except
those in a list get called.
Add a helper method for the repeated logic
of creating cache and config, and creating
and running the pingback.
Merge the two test cases for when a pingback
should actually be sent (no prior pingback in the
database, or the prior pingback is from more than a
month ago) to use a data provider.
Rename variables to be sligthly clearer.
Change-Id: I25daf4d78b7bea12a6bc68ace3827985e435d21d
Cleanup after the switch of Database::query() to return ResultWrapper
instead of resource.
* Soft-deprecate the IResultWrapper accessors in IDatabase.
* Move relevant DBMS-specific functionality to ResultWrapper subclasses.
The deprecated methods in IResultWrapper become short and simple.
ResultWrapper is now abstract (b/c break).
* Move the implementation of fieldName(), numFields() and one of the
fieldInfo() implementations to the ResultWrapper subclass in order to
avoid ResultWrapper::unwrap() calls.
* Make Database::doQuery() return a ResultWrapper subclass instead of
underlying result data, so that the Database parent class does not
need to be aware of wrapper construction.
* Hard-deprecate ResultWrapper::unwrap(),
DatabaseMysqlBase::fieldType(), DatabasePostgres::fieldType().
* Fix the inefficient seeking method in SQLite.
* Make FakeResultWrapper extend ResultWrapper with an implementation
similar to the SQLite one. This is possible because ResultWrapper does
not depend on IDatabase anymore.
* Resolve fixme in DatabasePostgres: from studying the source,
neither pg_fetch_object() nor pg_num_rows() can set an error
retrievable with pg_last_error(). Removed unnecessary warning
suppression.
* ResultWrapperTest didn't make sense as a unit test anymore, so I
adapted it as an integration test against the current DBMS.
This change also means that ResultWrapper::key() always gives the
correct offset, even if Iterator methods are not being used.
Bug: T286694
Change-Id: I935835316c0bd7d3d061bd8fde9c9ce99ce756ec
NOTE: this is a backwards incompatible change which will
need to have corresponding changes implemented in CentralAuth
and probably force-merged.
Depends-On: I4c2170a25ea8b1cf5410a4648ebec66a3ab253f3
Depends-On: I612460ec2c6a038b7155b3f38f3261757ba63b4e
Depends-On: I3b91b333753a877aceb177b7d38f9272a044f055
Depends-On: I9ae86c9a5da66d5857fcea9967012c6bbbfc4d45
Depends-On: I4a08af2227d0dfd833e16469df3f76e397dce669
Change-Id: I67bf4f2442269b8aa1002868ede9a71a5ca43a84
Currently, we have a UserIdentity, we retrieve the user id,
and then we create a User object based on the id. Instead,
create the User object based on the UserIdentity directly,
so that if the UserIdentity happens to already be a full User
object no change is needed.
This allows us to simplify WatchedItemStoreUnitTest by
not needing to tailor the mock UserFactory to the specific
user ids that we are using in each test case.
Change-Id: I52918b4f4c7d44086ea4fcdabdbfe14197c06373
Inline creation of single-use variables
Use $this->createMock() and createNoOpMock()
for FutureChangeTags.
Change-Id: I7d6632f61bc634279f62cefde9c7935143661c65
Use one line instead of three to document variable types.
Make ContentHandlerFactory final again, no need to make
non-final.
Use MockServiceDependenciesTrait to simplify creation
of PageUpdaterFactory in unit tests.
Use Wikimedia\Rdbms\LoadBalancer instead of deprecated
alias \LoadBalancer.
Follow-up: I2a060bfa8ac098edf24fc4d51212eeb7ddf3942d
Change-Id: I63b18f71cb6e40c971511e71e8475d49ef530d71