Commit graph

10522 commits

Author SHA1 Message Date
Umherirrender
f338645527 Create FauxRequestUpload to fake uploads in tests
And use it in core
Avoid direct use of super global $_FILES

This can breaks all FauxRequest relaying on $_FILES
in tests or production code via FauxRequest::getUpload.
Falls back to $_FILES for the moment

Bug: T48163
Change-Id: I7392acc9bb682ec6b7025dbed0734c142f45c91a
2021-04-06 23:10:43 +02:00
jenkins-bot
925f48123c Merge "Fix the test MonologSpiTest::testDefaultChannel" 2021-04-06 17:02:12 +00:00
Ammarpad
e497482ee4 DoctrineSchemaBuilder: Do not add prefix placeholder for Postgres at all
Adding it (only to be removed later) is not useful and interferes with
the internals of the schema builder because it masks the actual table
name during the table sql building and at some stages, this actual name
is required to be known

Bug: T191231
Change-Id: I57cc9b83c81f5c2d0d50c7b9e0dc334e7251c74f
2021-04-06 00:23:14 +00:00
Sébastien Beyou
0108c05cc4 Fix the test MonologSpiTest::testDefaultChannel
The NullHandler does no more implement FormattableHandlerInterface.

Bug: T196906
Bug: T242751
Change-Id: I3262b46483d3d77d25600e7ab1821bc0d4eecaad
2021-04-06 02:09:32 +02:00
jenkins-bot
2f7456c731 Merge "Use PageStore in RevisionStore" 2021-04-05 19:54:40 +00:00
daniel
fe9430947d Use PageStore in RevisionStore
This introduces PageStoreFactory as well.

Change-Id: I7abd3c6a8ea70a68e8f8e9460d3bdd8c6f45338a
2021-04-05 20:58:54 +02:00
jenkins-bot
5fb55cdca4 Merge "Convert ParserOutputAccess to PageRecord." 2021-04-05 17:27:04 +00:00
jenkins-bot
b50502395a Merge "Convert mail namespace to Authority/UserIdentity" 2021-04-05 17:26:58 +00:00
Petr Pchelko
cd66d7c335 Convert ParserOutputAccess to PageRecord.
Still needs to downcast to WikiPage in 2 places:

1. To check get a ContentHandler and check if content model
is cacheable. We probably should just make all content models
cacheable.
2. To call WikiPage::triggerOpportunisticLinksUpdate. I have
an elaborate plan for this one, but it will be done separately.

Change-Id: Ifd9ab0155dc1fad0c1608dafea05d16292afd057
2021-04-05 07:46:34 -06:00
jenkins-bot
3a047b749b Merge "Convert ParserCache to PageRecord" 2021-04-05 09:28:19 +00:00
jenkins-bot
97f0d8acd1 Merge "build: Swap deprecated @codingStandardsIgnore to phpcs:ignore" 2021-04-04 21:56:48 +00:00
jenkins-bot
09d103fa49 Merge "API: Clean up ApiPurgeTest" 2021-04-04 21:08:51 +00:00
Umherirrender
78cc6d77ff build: Swap deprecated @codingStandardsIgnore to phpcs:ignore
Bug: T278594
Change-Id: I09a6175917090593e6e0055203a890c32bea03a5
2021-04-04 21:18:22 +02:00
jenkins-bot
9659564175 Merge "Add Message/MessageValue datetime parameter types" 2021-04-04 17:34:28 +00:00
Petr Pchelko
f642215aed Convert ParserCache to PageRecord
ParserOptions not updated cause they depend on Title::getLanguage
implementation.

Tests converted to not require a DB anymore. Can't be proper unit
tests yet due to globals in ParserOptions and fake time hacks,
but exec time does go down from 70 seconds to 9 seconds.

Page content model is still emitted in the metrics since
it was considered useful. Should be removed when we get
something like a page type concept.

Change-Id: Ib16fd0b5b87ffc3cb4d21f4aa43d1203cb7206d2
2021-04-02 21:14:54 -06:00
jenkins-bot
7529354d03 Merge "Make stricter type checks on user email and real name" 2021-04-02 21:28:57 +00:00
Aaron Schulz
74ebf0ec9c objectcache: replace "coalesceKeys" with "coalesceScheme"
Key coalescing hints are now unconditionally enabled, using
the mcrouter style by default. This can be changed by setting
"coalesceScheme" (e.g. in case of experimental dynomite use).

Change-Id: I4866ed66d42d7d7da2b3edc2f99b8ba35fe3d511
2021-04-01 19:52:07 -07:00
Petr Pchelko
c621548cf8 Convert mail namespace to Authority/UserIdentity
Change-Id: I1e1ea72f94735ddaf66eab29aad1296e1abffb9b
2021-04-01 15:46:09 -06:00
Petr Pchelko
c44d44639b Make stricter type checks on user email and real name
Currently both email and real name are documented as
non-nullable, but it seems there's code that breaks
this contract. Try stricter type checks.

Depends-On: Ie8fa1e7881e1b016dccdc9097a1763a07cc140b9
Depends-On: Id3bf35fe56c459597ed6a602bdf6ca4860271f6e
Change-Id: I2f4b7b3500a2b25f7d5cf25147f65ad412d61955
2021-04-01 15:21:41 -06:00
Thiemo Kreuz
3ae4c5efc2 title: Fix bogus Title::getSkinFromConfigSubpage()
Same as I3d8c6f6 already did for two other methods. It looks like this
one was forgotten.

This patch also adds tests for the previously untested method
Title::getSkinFromConfigSubpage().

Note this patch changes the behavior of Title::getSkinFromConfigSubpage()
slightly. It will return an empty string much more often. This is not a
breaking change as far as I can tell. According to
https://codesearch.wmflabs.org/search/?q=getSkinFromConfigSubpage%5C(
there are only two known callers, and both guarantee the string passed to
this method contains both a slash and a dot. Returning an empty string in
all other cases is much closer to the original intent of the method. For
example. "User:Vector" will not be considered a valid skin name any more.

Bug: T229443
Change-Id: I0a5be39ca11a4e5d6c05f70eb05e80c6c4980523
2021-04-01 20:06:16 +02:00
jenkins-bot
f2de7593eb Merge "ContentHandlerTest: merge single use private method" 2021-04-01 05:31:51 +00:00
jenkins-bot
22570181d4 Merge "RevisionStoreRecord: Use MWTimestamp::getTimestamp for detailed errors" 2021-04-01 02:06:38 +00:00
jenkins-bot
bee15a1689 Merge "title: Fix Title::findSubpageDivider() destroying certain strings" 2021-03-31 07:49:07 +00:00
Petr Pchelko
c71781f54c Add Message/MessageValue datetime parameter types
This is used quite a lot in the codebase and it's
a reason for a lot of usages of $wgLang. Time and date
seems generic enough to put into Message library -
we already have references to Wikimedia\Timestamp
library there.

Bug: T278482
Change-Id: If7cb5f5dcfa736b6530f731af9dc3af168812054
2021-03-30 21:05:32 -06:00
DannyS712
6c483f2790 Add tests for ProxyLookup
Currently completely untested

Change-Id: I5d7b66af26fa612ff78673469a54b7b056dd276b
2021-03-31 00:21:24 +00:00
jenkins-bot
1c30d08a3c Merge "Make Title::isWatchable more strict" 2021-03-30 22:52:09 +00:00
Petr Pchelko
877720d7b4 Make Title::isWatchable more strict
We can't really watch invalid titles, since they
definitely can not exist in the database, so having
them in user watchlist doesn't make much sence either.

Bug: T278735
Change-Id: I411ca9227da8050d026a57db690824afd3423a89
2021-03-30 15:51:55 -06:00
DannyS712
1c6e823158 ProxyLookup: inject hook container
Change-Id: I97cdb4ed7ea1dea52cefa8cdce62fc904825a770
2021-03-30 18:46:53 +00:00
jenkins-bot
5bc4178005 Merge "AbstractBlock::setTarget() don't always use MediaWikiServices" 2021-03-30 18:03:40 +00:00
jenkins-bot
98cfa1c07d Merge "Split FallbackContentHandlerTest into separate unit tests" 2021-03-30 18:03:30 +00:00
DannyS712
57094675fc AbstractBlock::setTarget() don't always use MediaWikiServices
Creating any block class includes a call to AbstractBlock::setTarget
which uses MediaWikiServices, meaning that no blocks can
be created in unit tests. If the target is an empty string '', set
the target and type to null instead of using the BlockUtils
service, which would eventually set them to null but would require
using MediaWikiServices

Allows moving SystemBlockTest to a unit test

Change-Id: Icdf10a6b89aef1995b6e5b5cee9ba5dd5593b01e
2021-03-30 16:24:10 +00:00
jenkins-bot
13b9f8ebc2 Merge "MovePage: fetch $wgMaximumMovedPages from config" 2021-03-30 15:49:09 +00:00
DannyS712
7d398ffde6 Split FallbackContentHandlerTest into separate unit tests
Only testGetSlotDiffRenderer() requires integration
Clean up the code that is being moved, and fix
the remaining covers in the integration test

Change-Id: Ic5926b23daf6738c44d9a5aacb75276f81c51f7a
2021-03-30 14:23:00 +00:00
jenkins-bot
a303a47b60 Merge "Clean up PasswordPolicyChecksTest" 2021-03-30 11:59:25 +00:00
DannyS712
a57b4c813e MovePage: fetch $wgMaximumMovedPages from config
Instead of using the global...

Change-Id: Idf563e8d9fbf828121bd468ae56ec9ceb9a53ee0
2021-03-29 23:42:16 +00:00
jenkins-bot
10c07b3d14 Merge "PermissionManager: fetch $wgDeleteRevisionsLimit from config" 2021-03-29 23:31:28 +00:00
DannyS712
3b342cd9b7 PermissionManager: fetch $wgDeleteRevisionsLimit from config
Instead of using the global...

Change-Id: I9e387e475a482df4391a4beed1c2935d183e6e81
2021-03-29 22:33:43 +00:00
DannyS712
19b835c80b PermissionManagerTest: use data providers
Plus remove some duplicate cases

Change-Id: Ifa8d79cf99cc4e99d76f93c72a0eb986bc57d97b
2021-03-29 20:37:29 +00:00
jenkins-bot
65f50a437d Merge "Delete ObjectFactoryMakeContentHandlerWithSpecsToTest" 2021-03-29 18:43:17 +00:00
jenkins-bot
e623a91aab Merge "Fix replacement of control chars in DJVU text output" 2021-03-29 15:38:33 +00:00
jenkins-bot
24a3fdfc98 Merge "Convert ConverterTest to pure unit tests" 2021-03-29 15:03:48 +00:00
jenkins-bot
6f8ce4c8b8 Merge "Move MWDoxygenFilterTest to unit tests" 2021-03-29 15:03:13 +00:00
Inductiveload
32ea3a3fbe Fix replacement of control chars in DJVU text output
The control characters are presented as text, not actual
control characters, so the regexes to replace them are
incorrect.

Added a column and para to the Djvu text on the first page
of the test LoremIpsum.djvu file

Bug: T230415
Change-Id: I4970bc30b3935ce4da062ee7ff687aa667027a00
2021-03-29 06:03:34 +00:00
James D. Forrester
5c83c8952c tests: Avoid problematic language in comments and internal code
We can't avoid this entirely where we're testing upstream features
that are yet to be renamed, but this is a start.

Bug:T277986
Change-Id: I5c1ae717cc008ca147ea31fe35c44b19d1fe5d98
2021-03-28 21:21:28 -07:00
jenkins-bot
05ddc881bc Merge "auth: Convert AbstractAuthenticationProviderTest to a pure unit test" 2021-03-28 21:58:41 +00:00
DannyS712
97647157af auth: Convert AbstractAuthenticationProviderTest to a pure unit test
No integration is needed.
Additionally, change namespace to reflect that it's a test class
rather than normal code.

Change-Id: Iaa591310edde57de02c710ed1741388b4abafd01
2021-03-28 21:32:20 +00:00
DannyS712
c31b0562ec auth: Convert AbstractSecondaryAuthenticationProviderTest to pure unit test
No integration is needed.
Additionally, change namespace to reflect that it's a test class
rather than normal code.

Change-Id: Iaa05945805e3417ee149204b3e5b4085e6a06007
2021-03-28 21:31:50 +00:00
DannyS712
292557ed42 Move MWDoxygenFilterTest to unit tests
Extends PHPUnit\Framework\TestCase
and does not require any integration logic

Start new /tests/phpunit/unit/maintenance/
directory

Change-Id: I126dba699e829544a571bf795de6536a0ed9b977
2021-03-28 18:33:51 +00:00
DannyS712
bd1ca06a5e Delete ObjectFactoryMakeContentHandlerWithSpecsToTest
Its a test for the ObjectFactory code that is underlying
the ContentHandlerFactory class, but that code is already
tested elsewhere extensively - these tests add nothing
for the library, and don't cover the actual ContentHandlerFactory
code either.

Change-Id: I74a141d592a2582be8f6b2b81a392e5eebc27ec4
2021-03-28 14:03:46 -04:00
DannyS712
1795bd1bac tests: Use data provider for UserEditCountInitJobTest cases
Reduces code duplication.

Change-Id: Id29676cabdbee372f9b2cc23f8658fe671a45cf8
2021-03-27 02:13:13 +00:00