Commit graph

6894 commits

Author SHA1 Message Date
Reedy
3ecbd79ebe Add test to check action- messages exist
Bug: T220779
Change-Id: Ide681e1f03957a8024f538ea6cac4e4396fef23e
2019-04-12 17:44:33 +00:00
jenkins-bot
6497541c9c Merge "Fix order of @var parameter in PHP" 2019-04-12 15:17:23 +00:00
Fomafix
9cbb8f104d Use https://www.php.net/ instead of https://secure.php.net/
Change-Id: I0acca592c6909e91b28b904da49dcbd6a43cd2a5
2019-04-12 06:44:48 +02:00
jenkins-bot
1f20098a8d Merge "resourceloader: Move expandModuleNames() to ResourceLoader.php" 2019-04-11 22:31:25 +00:00
Timo Tijhof
f2bf73a4c4 resourceloader: Move expandModuleNames() to ResourceLoader.php
This has always been an odd case, as indicicated by the cross-class
comment references, and the fact that its test cases are already
in ResourceLoaderTest.php, for convenience, as that's also where
the creation of 'module name strings' is done and tested.

Actually move it there instead of pretending it is there.

Change-Id: Ied9569436cc78704a5c1b75eeebb73f8631350f6
2019-04-11 21:06:53 +00:00
Max Semenik
20865b4a6f Remove CryptRand and related stuff
Deprecated in 1.31 and not used anywhere.

Change-Id: Idc2e9cec907e39cacc391fdd7e2718bd880081ae
2019-04-11 18:20:09 +01:00
jenkins-bot
3af4b19908 Merge "tests: Mock the time in NameTableStoreTest to avoid failures if they run slowly" 2019-04-10 17:31:42 +00:00
Aaron Schulz
e4e7b650ef tests: Mock the time in NameTableStoreTest to avoid failures if they run slowly
Bug: T220626
Change-Id: I4f8e0321f540b9ff48f3297a1ca0c6196c99ecf8
2019-04-10 17:18:05 +00:00
jenkins-bot
b014d77a48 Merge "Drop clearCache() from (Configured)ReadOnlyMode" 2019-04-10 17:07:37 +00:00
Aryeh Gregor
9d5e3ad0f5 Drop clearCache() from (Configured)ReadOnlyMode
These are services, so tests should just override services to reset
them.

Change-Id: Icb1a041f8fac1ea0b7421e69b7b31b24171d868b
2019-04-10 19:39:34 +03:00
jenkins-bot
0d58c1ddda Merge "jobqueue: add GenericParameterJob and RunnableJob interface" 2019-04-10 16:07:09 +00:00
Tim Starling
421b4258b5 Sort MediaWikiServices and ServiceWiring alphabetically
Don't sort them asciibetically, which is a weird sort order people only
use by accident.

Change-Id: I69be64dab104130841855f2ce58bf94667c0c300
2019-04-10 20:59:49 +10:00
jenkins-bot
013b6fac88 Merge "NamespaceInfo service to replace MWNamespace" 2019-04-10 05:46:24 +00:00
Aryeh Gregor
76661cf129 NamespaceInfo service to replace MWNamespace
MWNamespace::clearCaches() has been removed entirely, along with the
$rebuild parameter to MWNamespace::getCanonicalNamespaces(). The rest of
MWNamespace is deprecated.

Diff best viewed with -C1 so git notices that NamespaceInfo is a copy of
MWNamespace.

Depends-On: Icb7a4a2a5d19fb1f2453b4b57a5271196b0e316d
Depends-On: Ib3c914fc99394e4876ac9fe27317a1eafa2ff69e
Change-Id: I1a03d4e146f5414ae73c7d1a5807c873323e8abc
2019-04-10 02:07:36 +00:00
jenkins-bot
1f46e0e6dc Merge "Default $wgActorTableSchemaMigrationStage to READ_NEW" 2019-04-09 20:26:30 +00:00
Brad Jorsch
0301c8e03a Default $wgActorTableSchemaMigrationStage to READ_NEW
Probably good to start testing this in CI sometime soon.

The unit tests being changed here are:
* Hacky importing of a revision in MessageCacheTest, changed to use an
  interwiki username.
* WikiPageDbTestBase will get null rather than 0 for ar_user.
* DumpTestCase was using a custom IP $wgUser when creating its test
  revisions, which was winding up referring to an actor_id that had been
  deleted from the database. Fixed by having it use a registered user
  instead.

Also this has MediaWikiTestCase reset the $wgUser User object when the
actor table is truncated, as various tests were otherwise failing because
it was caching a later-deleted actor ID for User:127.0.0.1.

Bug: T188327
Change-Id: Ic483d0fda931810ac639b9de1cc5e5a4ef8161cc
Depends-On: I1bd0288cc132627d75b4001219522ec5e952eda7
2019-04-09 13:50:41 -04:00
jenkins-bot
3f134f0834 Merge "MediaWikiTestCase: Fix schema restoration" 2019-04-09 15:17:45 +00:00
Aryeh Gregor
0762854560 Hard-deprecate MagicWord static methods
Bug: T200247
Change-Id: Ib36e78274f42ddbeaa7801cc8bad77b991a4a1aa
2019-04-09 11:51:36 +03:00
Aaron Schulz
fc5d51f129 jobqueue: add GenericParameterJob and RunnableJob interface
Simplify the code of jobs that do not care about titles and removes
the direct Title dependency from JobQueue. Remove getTitle() from
IJobSpecification itself. Move all the Job::factory calls into a
single JobQueue::factoryJob() method.

Depends-on: Iee78f4baeca0c0b4d6db073f2fbcc56855114ab0
Change-Id: I9c9d0726d4066bb0aa937665847ad6042ade13ec
2019-04-08 11:05:23 -07:00
Brad Jorsch
f552b10fea MediaWikiTestCase: Fix schema restoration
First, after restoring the old schema it needs to clear the variable so
it doesn't keep "restoring" again and again for every subsequent test
class.

Second, after restoring the old schema it needs to repopulate anything
added by addCoreDBData() that was lost by dropping and recreating the
affected tables, which is easiest done by calling $this->resetDB().

Change-Id: I549d10eb7ceec117d3a0138449ca01f8065707d4
2019-04-08 13:52:10 -04:00
Fomafix
14d9e80ba4 Fix order of @var parameter in PHP
Replace

 @var $foo type

by

 @var type $foo

Change-Id: Iec8b90ffea4028a1005daef422b7c4ec38c2715f
2019-04-08 18:37:56 +02:00
jenkins-bot
603740b43b Merge "Change Database type hints to use IDatabase" 2019-04-07 09:13:34 +00:00
Aaron Schulz
deaf6b0e5d Change Database type hints to use IDatabase
Change-Id: Ie1e86cd961a619335138402ba22fe2a73a3e62fd
2019-04-07 01:15:50 +00:00
Timo Tijhof
9e1e44910e resourceloader: Add missing (string) cast to ClientHtml tests
One of the assertions already did this, but the others not yet.

The reason we do this is because the return value is a WrappedString
object. The assertEquals() method is able to satisfy the expected
value because of loose comparison casting it to a string for the
case where it matches.

But, when it fails during development, PHPUnit was still printing
the object as "Actual" and the string as "Expected" which makes
it difficult to understand what's going on, and also no diff.

Change-Id: Ice9fe5061fb76867e9bee2f34c88d3ddac3144f9
2019-04-07 00:14:22 +01:00
Timo Tijhof
d9891f872f phpunit: Don't include PHPUnitCommand channel in MediaWikiLoggerPHPUnitTestListener
Follows-up 96657099fc (T217489) adding MediaWikiLoggerPHPUnitTestListener.
It started printing messages from log channels to CLI output when there
is one or more failed assertions. This is useful.

But, it also interacts with MediaWikiPHPUnitTestListener from 2018,
which calls wfDebugLog('PHPUnitCommand', …) for every test and every
assertion. That allows one to later open debug.log and see MediaWiki's
messages interleaved with PHPUnit activity. This provides messages from
a much larger scope (including before test setup, and data providers).

But, this means we get:

 > There were N failures:
 > 1) ExampleTest::testGetThing
 > === Logs generated by test case
 > [PHPUnitCommand] [info] FAILURE in ExampleTest::testGetThing:
 > [PHPUnit\Framework\ExpectationFailedException] Failed asserting …
 > …
 > …
 > …
 > … {"private":false}
 > ===
 > Failed asserting that …
 > --- Expected
 > +++ Actual
 > @@ @@
 > …
 > /var/www/mediawiki/tests/phpunit/includes/…:…

This needlessly repeats the test name and method, and takes up
vertical space to describe the failed assertion in a way that is
less useful than the one that PHPUnit already prints after it.

Exclude these by default from CLI.

Bug: T217489
Change-Id: I0f471f82b16ba869d15389ed470bd73dc6deea78
2019-04-07 00:10:16 +01:00
jenkins-bot
b5e255e914 Merge "rdbms: add and enforce DB_REPLICA/DB_MASTER roles in DBConnRef" 2019-04-06 09:54:16 +00:00
Aaron Schulz
0c98c5d4a2 Make teardownTestDB() close any dangling connections before changing the prefix
Bug: T219673
Change-Id: I028fc16b874cac744f7215601eec754a76f31a3f
2019-04-05 19:52:40 +00:00
jenkins-bot
044d888c41 Merge "Remove broken explode() from MediaWikiMediaTestCase::dataFile()" 2019-04-05 17:55:40 +00:00
jenkins-bot
b235c8be4b Merge "Introduce PermissionManager service" 2019-04-05 16:45:32 +00:00
jenkins-bot
1ae3ebe824 Merge "Introduce 'clone' flag for newFromLinkTarget." 2019-04-05 16:45:23 +00:00
Vedmaka
8e1342ed47 Introduce PermissionManager service
First iteration of adding a PermissionManager service as a replacement
for Title::userCan and User::isBlockedFrom methods.

- Created PermissionManager service
- Migrated Title::userCan to PermissionManager::userCan and deprecated the first
- Migrated Title::quickUserCan to PermissionManager::quickUserCan and deprecated the first
- Migrated User::isBlockedFrom to PermissionManager::isBlockedFrom and deprecated the first

Same for User::isBlockedFrom and PermissionManager::isBlockedFrom - the
$user parameter is now required so the declaration is changed from
isBlockedFrom( $title, ... ) to isBlockedFrom( $user, $title, .. ) which
means before User::isBlockedFrom removal all calls to it need to be updated.

Added PermissionManagerTest, it copies TitlePermissionTest but uses
PermissionManager instance instead of Title methods, this way keeping both tests
in place, we can ensure that nothing was broken and both are in working state
during the deprecation phase.

Bug: T208768
Change-Id: I94479b44afb3068695f8e327b46bda38e44e691f
2019-04-05 14:54:51 +00:00
daniel
2d721e69e8 Introduce 'clone' flag for newFromLinkTarget.
The "new" part of some of the newXXX pseudo-constructors
in the Title class is a lie: these methods do not always
return a new instance. This patch ensures that this fact is
documented, and we have a safe way to get a fresh Title
from a LinkTarget.

Needed by I94479b44afb30

Change-Id: I4d561ef7d7447d3d6e35079cf656bd564882d25e
2019-04-05 16:52:06 +02:00
Aaron Schulz
eb603040de rdbms: add and enforce DB_REPLICA/DB_MASTER roles in DBConnRef
Even if there is only one database, if a DB_REPLICA connection
reference is obtained and an attempt is made to write it then
it will still fail. This can make it easier to spot incorrect
database usage even in a simple vanilla developer environment.

Note that methods like ILoadBalancer::getConnectionRef() can
be used for local connections as well as foreign ones.

Change-Id: I5523daad1bdd64624d3e0dd41bfd8d078b1078b0
2019-04-05 09:03:50 +00:00
Aaron Schulz
cd4e33a3b9 Clean up LoadBalancerTest and move more code to private methods
Change-Id: I4c541537f9b95918f8d1a057ccbc29e8525ddc15
2019-04-04 21:18:37 -07:00
Agabi10
d19a6fe542 Avoid hitting DB in Category getters when they have the required info
Bug: T63045
Change-Id: Ib881ce263fa7a4a8256f627a56b774aaa815d3df
2019-04-04 12:40:14 -07:00
jenkins-bot
75f937543b Merge "Collapse some nested if statements" 2019-04-04 19:29:31 +00:00
Reedy
c13fee87d4 Collapse some nested if statements
Change-Id: I9a97325d738d09370d29d35d5254bc0dadc57ff4
2019-04-04 19:02:22 +00:00
Aaron Schulz
b48dcf28d6 jobqueue: dependency inject more objects into JobQueue
Also moved some WikiMap/$wgJobClasses checks to JobQueueGroup::pop
which is the method callers are supposed to use.

Change-Id: I2ab82d8adc4ae1f54697d2935afa2053539cf2db
2019-04-04 01:32:59 -07:00
jenkins-bot
a38f665c0b Merge "phpunit: Call 'teardownTestDB' from shutdown instead of destruct." 2019-04-04 04:24:39 +00:00
jenkins-bot
df11591222 Merge "Check line length of HISTORY" 2019-04-04 00:08:32 +00:00
jenkins-bot
1a99d2c3bc Merge "RecentChanges updated to use pseudo elements for presentation" 2019-04-02 23:12:57 +00:00
jdlrobson
5040b3f680 RecentChanges updated to use pseudo elements for presentation
Bug: T219348
Change-Id: I6eeeaa3b58d37adb7fefb4cc6915022229b3b324
2019-04-02 14:52:50 -07:00
Jason Linehan
aed6be47ac Fully utilize LinkTarget passed to getRevisionByTitle
Failure of getRevisionByTitle to pass its LinkTarget argument
to newRevisionFromRow resulted in a needless second instantiation
of the Title (an extra query).

Because newRevisionFromRow needs a Title, not just a LinkTarget,
it is unfortunately necessary to call Title::newFromLinkTarget
on it for now -- however this does not involve a DB lookup and
is on track to be fixed with revisions to the Title class.

Bug: T206498
Change-Id: Ic6f98d8fbf66d85121668571c17e148efc5ec2be
2019-04-02 21:25:45 +00:00
Reedy
bd292da07f Check line length of HISTORY
Slight modifications, almost all for URLs.

Change-Id: I612852e9a677a6a14fd48e2ccd7fcb998da9152a
2019-04-02 13:10:34 -07:00
jenkins-bot
549bc9ee04 Merge "Add test for Special:page::buildPrevNextNavigation" 2019-04-02 19:18:27 +00:00
jenkins-bot
5166d5e8cb Merge "Set default for Block::appliesToPasswordReset to true" 2019-04-02 14:15:23 +00:00
Thalia
846d84fa18 Set default for Block::appliesToPasswordReset to true
Follow-up to Ia3f46aba. Before that patch, the default case for
whether a block blocks password reset was true.

Bug: T218905
Change-Id: I86cb381762890abddcf32f4f7199799391cc6dfb
2019-04-02 14:43:09 +01:00
daniel
f5abf23379 Add test for Special:page::buildPrevNextNavigation
Change-Id: Ie17221305ec979acebebb62798b83f5d91df1f60
2019-04-02 13:59:46 +02:00
jenkins-bot
9c196be1d4 Merge "Fix flaky test BlockListPagerTest::testFormatValue" 2019-04-01 17:10:29 +00:00
David Barratt
af0720e5ed
Fix flaky test BlockListPagerTest::testFormatValue
The test relied on being executed within the same minute as when it starts
which is not always the case.

Bug: T219695
Change-Id: I99eb0d25138069ca08c2975ff2e60c7f1df0a99f
2019-04-01 12:06:59 -04:00