Commit graph

8794 commits

Author SHA1 Message Date
jenkins-bot
752bdc2652 Merge "Call BitmapMetadataHandler functions statically" 2020-05-18 19:42:28 +00:00
Tim Starling
09809678d5 Fix testAutomaticSqlGeneration: don't write to the source tree
Tests should not write to the MediaWiki source tree. They should use
temporary files.

Change-Id: Ifc8f6e3822e76493d6a750c2bc0d78262f1d2a4a
2020-05-18 12:29:18 +10:00
Reedy
f4f95e9f94 Call BitmapMetadataHandler functions statically
Change-Id: I88ff55ce68505fceffa2148ab26813c9ea2f6335
2020-05-18 00:53:43 +01:00
Reedy
5f1000f7bd Fix languages/ PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I6f88f2eaf2fc69016b99124eeb9f6e2616c148d2
2020-05-16 21:49:02 +01:00
Reedy
07faedc8c6 Fix more libs PSR12.Properties.ConstantVisibility.NotFound
Change-Id: If3bac6b0ff6fbb89bfa2b9fa91809135a76c610b
2020-05-16 20:13:22 +00:00
jenkins-bot
c54453b7e9 Merge "Add test to compare generated sql with the abstract schema" 2020-05-16 18:36:38 +00:00
Amir Sarabadani
bfe636bb18 Add test to compare generated sql with the abstract schema
This helps preventing mistakes, for example if you don't know or you
forget to generate the sql schema for one or all of them.
Also it helps preventing malicious changes to the generated files that
might go in without much scrutiny as the manual files.

Bug: T252919
Change-Id: I50e2715a55914f7712f9925c149bd09e8265a20b
2020-05-16 19:57:54 +02:00
Reedy
a8b006426e Fix tests/ PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I0beed1a35e046705fb84c9d1f63cf92afd009bb4
2020-05-16 04:30:21 +01:00
jenkins-bot
e1fa782031 Merge "Fix inverted assertions in ContentSecurityPolicyTest" 2020-05-15 17:58:37 +00:00
DannyS712
cc8296b309 Add Unit tests for SpamChecker service
Brings coverage to 100% (up from 0%)

Bug: T251015
Change-Id: I264f9c6cd0d9926ee73b48f33d5083c12338b09d
2020-05-15 17:02:30 +00:00
Clara Andrew-Wani
ebcfc952ad TalkPageNotificationManager: Undeprecate passing null to setUserHasNewMessages
See: T239640#6130351

Bug: T239640
Change-Id: I27222d21383455f81f292a88f19da88a699275cf
2020-05-14 16:29:48 -04:00
Thiemo Kreuz
31b4b8d65b Fix inverted assertions in ContentSecurityPolicyTest
Note that some (not all) of these are flipped, listing the expected
value second. I guess this is because it's like this in QUnit.

This patch also replaces loose assertEquals() checks with the more
strict assertSame(), which should be preferred when comparing strings.

Change-Id: I5bb27a6b63ab1642fab60483647d6b663100b144
2020-05-14 19:23:37 +02:00
jenkins-bot
7a0cfac4e6 Merge "Add HookRegistry" 2020-05-14 13:33:49 +00:00
jenkins-bot
db2a51db27 Merge "Add MergeHistoryFactory interface, implemented by PageCommandFactory" 2020-05-13 21:26:35 +00:00
MusikAnimal
a1ddac1d54 Add methods to check if a page is temporarily watched
Add 'mw-watchlink-temp' class to watch link when temporarily watched.

Bug: T248495
Change-Id: I61b24fddf6aaf5233f426602bfa1cc4fafce942b
2020-05-13 19:11:52 +00:00
DannyS712
29aa36c06e Add MergeHistoryFactory interface, implemented by PageCommandFactory
Bug: T249446
Change-Id: I94676e065a8aed5cad2fe2d5cf16ca586adce97d
2020-05-13 19:08:09 +00:00
jenkins-bot
2ecf403a16 Merge "mime: Fix whitespace parsing of 'mime.info' file" 2020-05-13 17:48:36 +00:00
Ori Livneh
a7e9412297 mime: Fix whitespace parsing of 'mime.info' file
Some entries in mime.info used runs of spaces instead of tabs to
separate the list of MIME types from the media type field, and the
mime.info code handled that incorrectly. This led to us treating the
empty string as a valid MIME alias for application/sla.

Fix that by splitting on /\s+/ rather than ' '. Also made tab usage in
mime.info uniform. I'd document the convention, but I plan on nuking
mime.info in a forthcoming changeset anyway.

Bug: T252228
Change-Id: I06c733b54fd622280ea67e206340598605cb6958
2020-05-13 17:28:26 +00:00
WMDE-Fisch
40aba4175b Make formatLinksInComment understand and link [[Text[[Link]]
In Wikitext this will end up in [[Link]] being converted to a link.
In comments this is ignored prior to this patch.

Bug: T197958
Change-Id: I454d342a57c35c30af042349a04e3b86d778568f
2020-05-13 14:26:35 +02:00
Tim Starling
b3d762e148 Add HookRegistry
Add a HookRegistry interface and two concrete implementations,
representing HookContainer's view of its environment. This simplifies
creation of a HookContainer for testing.

Add MediaWikiTestCaseTrait::createHookContainer() which can be used
in most of the places that were previously creating mock hook
containers. It can also replace setTemporaryHook() in some cases.

Change-Id: I9ce15591dc40b3d717c203fa973141aa45a2500c
2020-05-13 11:51:02 +10:00
jenkins-bot
30458d23c9 Merge "HookContainer Integration Test" 2020-05-13 01:37:25 +00:00
jenkins-bot
b213a54efc Merge "Add tests for RevisionList/RevisionItem classes" 2020-05-12 17:57:29 +00:00
DannyS712
4a206f1f90 Add tests for RevisionList/RevisionItem classes
Fix RevisionItemBase::getId to actually return an int, as intended

Previously all four classes (RevisionItem, RevisionItemBase,
RevisionList, and RevisionListBase) had no coverage. Now:

+--------------------------------------------+-------+--------+
| Filename                                   | Old % | New %  |
+--------------------------------------------+-------+--------+
| includes/revisionlist/RevisionItem.php     | 0     |  46.77 |
| includes/revisionlist/RevisionItemBase.php | 0     |  70.27 |
| includes/revisionlist/RevisionList.php     | 0     | 100.00 |
| includes/revisionlist/RevisionListBase.php | 0     |  76.32 |
+--------------------------------------------+-------+--------+

Bug: T252076
Change-Id: I3da1ae350986ef6dc54a13ae9275b4c1d03f6e5b
2020-05-12 09:36:44 -07:00
jenkins-bot
92ea11da95 Merge "SpecialBlock: Inject PermissionManager rather than creating it through MediaWikiServices" 2020-05-12 07:35:30 +00:00
jenkins-bot
4a5c7b4e84 Merge "Deprecate no LanguageNameUtils constructing DefaultPrederencesFactory" 2020-05-11 21:13:20 +00:00
Nikki Nikkhoui
5a6f9968ce HookContainer Integration Test
Integration test for HookContainer.
Tests that hook handlers registered in extension.json
and through HookContainer::register() are executed.

Bug: T251444
Change-Id: I552ae606794d4482f7e8a4b0b67fd35b302e43f8
2020-05-11 13:45:39 -07:00
Petr Pchelko
2436bb635e Rename DefaultOptionsManager to DefaultOptionsLookup
This is not really a manager, since it only supports
reading defaul options. Inroduced in 1.35 and not yet
used outside of core, so no deprecations are needed.

Change-Id: If67af54574d9c2e44ed85d1bdd098afd0a21e8f9
2020-05-11 12:19:13 -07:00
James D. Forrester
e1992a74a2 Actually deprecate the UserSetCookies
This was deprecated in hooks.txt as deprecated in 1.27 but never actually
hard-deprecated.

Bug: T232880
Change-Id: I2195f672a44ae107937c61718f9ef19073db169f
2020-05-11 10:59:38 -07:00
jenkins-bot
d9da0268db Merge "Update setTemporaryHook() to use scopedRegister()" 2020-05-11 04:55:18 +00:00
Nikki Nikkhoui
8d378e977c Update setTemporaryHook() to use scopedRegister()
The new HookContainer.php introduces a scopedRegister() method for
temporarily setting hooks. Let's use that in MediaWikiUnitTestCase
and MediaWikiIntegrationTestCase instead of directly accessing
global $wgHooks to do so.

Also introduces setTemporaryHook() and removeTemporaryHook()
methods in MWIntegrationTestCase for easily adding/removing of
temporary hooks.

Bug: T250300
Change-Id: I8cefd41b66f882c53646b76de76c51f0d8730f72
2020-05-11 14:12:00 +10:00
jenkins-bot
c7ca79509d Merge "MediaWikiIntegrationTestCase remove temporary handler" 2020-05-11 03:28:14 +00:00
jenkins-bot
8fc63e1bcd Merge "Fix SingleSpaceBeforeSingleLineComment" 2020-05-11 01:31:05 +00:00
Reedy
12a3883a7b Fix SingleSpaceBeforeSingleLineComment
Change-Id: I285af438ce484af40741489797f20455726ec110
2020-05-11 00:57:11 +00:00
Reedy
f96a15692b Function visibility in ParserFactoryTest.php
Change-Id: I043f0b92ac0694aa5c36267edd77869b707f4812
2020-05-10 23:44:08 +01:00
Umherirrender
a8161ec101 Add missing visibility on methods of deferred related classes
Change-Id: I959f95a46b7b0bc0973154231c72bdb787fffa53
2020-05-10 22:15:41 +00:00
Reedy
ead6b1e53f Fix some PSR12.Properties.ConstantVisibility.NotFound in tests/phpunit/
Change-Id: I0f678049dc274f0cd29f543bb293c33da51d8529
2020-05-09 23:55:09 +00:00
Amir Sarabadani
11f241589b Wire empty abstract schema into installer
For more information on schema changes see:
https://www.mediawiki.org/wiki/Manual:Schema_changes

Bug: T191231
Bug: T230428
Change-Id: I779b9c61e388e998738a2ed41b0b8e2afdecd232
2020-05-09 20:42:11 +02:00
jenkins-bot
6f59819d56 Merge "Small improvements to DoctrineSchemaBuilder and generateSchemaSql" 2020-05-09 14:37:14 +00:00
Amir Sarabadani
6319ffa1b7 Do not assume case in checking NULL in DatabaseSqliteTest
Currently, when trying to automatically generate the schema, it
majestically explodes because "NULL" is not equal to "null".

Change-Id: I0facf313525eee1af31fdb307368ecf3bdda895b
2020-05-09 14:10:08 +00:00
Amir Sarabadani
dbbb3af6dc Small improvements to DoctrineSchemaBuilder and generateSchemaSql
Adding scope to const, adding docstring, adding comments to generated
files, fix default path.

Bug: T230428
Change-Id: I955a446421ffe5c8fa42aeedc0f962230e92e02a
2020-05-09 16:08:44 +02:00
jenkins-bot
06a884c9ee Merge "phpunit: Add error_reporting/AtEase check to MediaWikiUnitTestCase" 2020-05-09 02:49:10 +00:00
jenkins-bot
5596d62bd2 Merge "skins: Move some BaseTemplate functions to Skin" 2020-05-09 02:36:46 +00:00
jdlrobson
20a6e532a5 skins: Move some BaseTemplate functions to Skin
This is part of refactoring skin code to allow us to move away
from SkinTemplate.

Move BaseTemplate functions to skin and soft deprecate them
to avoid compatiblity issues so they can be used inside the
Skin class by skins not using BaseTemplate

Note to reviewers:
The function bodies are copied without modification to Skin
with the following exceptions:
1) A phan comment is dropped and the only change.
2) wfMessage is replaced with msg

See I7a14f74728703c50874935e9d77b35ad9434b436 for a
bigger picture view of how
this would simplify Vector's codebase

Update function of `getStructuredPersonalTools`
to not use SkinTemplate

Bug: T251212
Depends-On:  Ifd9bbc9c909626ecfe8ccd085673bc777423d560
Change-Id: I99c7cebc277cb0680ab369c78f02ab370193d5c5
2020-05-09 02:23:48 +00:00
Timo Tijhof
355a6cd4c3 phpunit: Add error_reporting/AtEase check to MediaWikiUnitTestCase
This existed on MediaWikiIntegrationTestCase, but not on
MediaWikiUnitTestCase. As a result of that, I spent about four
days tracking down a dangling AtEase::suppressWarnings with
missing AtEase::restoreWarnings (as part of Ib6758d724c).

Move it to the common MediaWikiTestCaseTrait instead so that we
get it on unit/ as well.

Example:

> There was 1 failure:
>
> 1) Pbkdf2PasswordTest::testCryptThrows
> PHP error_reporting setting found dirty.
> Did you forget AtEase::restoreWarnings?

Change-Id: I7dc3fe90385c8066b89a5e06c55f5455edfbb4ca
2020-05-09 01:48:45 +00:00
Martin Urbanec
21d48c200f SpecialBlock: Inject PermissionManager rather than creating it through MediaWikiServices
Bug: T252253
Change-Id: Ia9992e3d185bd69cfa9dee5ef6922d66ac41ac05
2020-05-09 01:05:34 +02:00
jenkins-bot
b522caf749 Merge "Deprecate a few more tidy-related methods" 2020-05-08 22:32:38 +00:00
Nikki Nikkhoui
0194507035 MediaWikiIntegrationTestCase remove temporary handler
Add the ability to remove a temporary hook handler. This function
was initially part of https://gerrit.wikimedia.org/r/c/mediawiki/core/+/589097
but needed to be split up because it was part of a circular dependency of
patchsets, where
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CirrusSearch/+/595222
was dependent on it.

Bug: T250300

Change-Id: I0c41f50a6416fd2fe5607278e31c0a07f28dd3d8
2020-05-08 14:19:27 -07:00
jenkins-bot
a95577a0ee Merge "deferredupdates: support limited DeferredUpdates::doUpdates()" 2020-05-08 18:34:08 +00:00
jenkins-bot
69011218a7 Merge "RevisionStore: improve error handling in newRevisionsFromBatch" 2020-05-08 17:51:45 +00:00
jenkins-bot
20bfc01395 Merge "objectcache: add "non-global" mode to WANObjectCache "coalesceKeys"" 2020-05-08 17:15:07 +00:00