Commit graph

40 commits

Author SHA1 Message Date
James D. Forrester
64898405cb build: Upgrade mediawiki-codesniffer from v35.0.0 to v36.0.0
Change-Id: I8905d0d69738a1cd6997c104080fdf128d315e8b
2021-04-29 13:00:15 -07:00
jenkins-bot
e2abc63ac6 Merge "RecentChange: replace Title in method signatures" 2021-04-26 22:24:57 +00:00
daniel
c7eca76241 RecentChange: replace Title in method signatures
Bug: T278459
Change-Id: I144ea130f29ec437302649d86494034af044c524
2021-04-26 17:48:02 +02:00
Thiemo Kreuz
40764d277c Replace PHPUnit ->returnValue() with ->willReturn() shortcut
It's the same and makes the test code much more readable, I
would like to argue.

Because of the was I split all the changes I made into smaller
patches this patch contains some other changes in the same
lines where I could not split them off. E.g. removal of
->any(), which is the default anyway and doesn't do anything.

Change-Id: Ib297b989d4aec33b31a4e33fe9d5032865b39be0
2021-04-22 10:37:45 +02:00
daniel
fed7f0b179 Remove $actor field from UsererIdentityValue
Code that needs to store an actor ID in the database to
represent a UserIdentity, or needs to construct a UserIdentity based on
an actor ID loaded from the database, should use the ActorNormalization
service.

Note: The getActorId() method is removed from the UserIdentity interface,
but all concrete classes continue to support it for now.
UsererIdentityValue::getActorId() is hard deprecated and should
be removed in 1.37. It always returns 0.
User::getActorId() is not deprecated at this point.

Bug: T274179
Depends-On: Id2b3ddf6a2a7cdf90f8936a69148d2cce6fde237
Change-Id: I9925906d11e47efaec3c1f48d5cb3f9896a982c1
2021-04-13 18:18:06 +00:00
daniel
5a058b7c18 Convert RecentChange to use UserIdentity and ActorStore
Note: this removes 'rc_actor' from the public attributes array.
There is no access to this field in any known extension.
It seemed to be there purely by analogy to the database schema.

Bug: T276853
Change-Id: Ib9fe44567660ec1e42cc788f69b9a4101a8a3460
2021-03-11 19:44:29 +01:00
Petr Pchelko
7e799cc7f5 Convert RecentChange::doMarkPatrolled to Authority
Change-Id: If93d6133f61bf0801bbe979885e2fb120e01a33d
2021-03-03 20:23:56 -07:00
DannyS712
ebd14f373d RecentChangeTest::testParseParams use a data provider
Reduces code duplication

Change-Id: I9e200bfe8d5b8f3b5ac732ea3498c09883b23645
2021-03-01 19:09:22 +00:00
DannyS712
e4db469262 Convert PageProps to a service
Bug: T253188
Change-Id: Ic358946099a3424a3d1c2615feb14e74b6336a0e
2020-08-12 21:21:53 +00:00
addshore
959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00
Thiemo Kreuz
5f3a92385b Fix visibility of setUp/tearDown
Change-Id: I636be48eb9f713680abac35d46091f7b49374696
2020-06-16 21:02:05 +02:00
Thiemo Kreuz
6b2c9deef5 Replace all new stdClass() with identical (object)[]
This should be the exact same. Its more a style change than anything.
So why do it then?
* I believe this is much less confusing than code mentioning a weird
"standard class". Barely anybody knows what this is, and what the
difference between "object" and "stdClass" is.
* The code is shorter.
* It's even faster. In my micro benchmark it's twice as fast.

Change-Id: I7ee0e8ae6d9264a89b6cd1dd861f0466ae620ccc
2020-03-04 21:18:30 +00:00
Max Semenik
48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00
Max Semenik
fb06e4cd85 Update tests to use PHPUnit 6 class names
Bug: T192167
Change-Id: I42b0c8908b4968b95b08f861a40af18dc79fa0a1
2019-10-06 01:01:28 -07:00
Thiemo Kreuz
8a4e15db7f Add missing newline between <?php and namespace/use section
The rest of the codebase is using this code formatting standard.

Change-Id: I4d2ba61757a7e28d40096d9dc5915005c340d4f2
2019-06-03 13:36:48 +00:00
Brad Jorsch
27c61fb1e9 Add actor table and code to start using it
Storing the user name or IP in every row in large tables like revision
and logging takes up space and makes operations on these tables slower.
This patch begins the process of moving those into one "actor" table
which other tables can reference with a single integer field.

A subsequent patch will remove the old columns.

Bug: T167246
Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50
Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
2018-02-23 10:06:20 -08:00
Reedy
39f0f919c5 Update suppressWarning()/restoreWarning() calls
Bug: T182273
Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
2018-02-10 08:50:12 +00:00
Brad Jorsch
11cf01dd9a Add comment table and code to start using it
A subsequent patch will remove the old columns.

Bug: T166732
Change-Id: Ic3a434c061ed6e443ea072bc62dda09acbeeed7f
2017-08-30 15:05:00 +10:00
Timo Tijhof
e27ed2f378 phpunit: Fix RecentChangeTest failure when coverage is enabled
From <https://integration.wikimedia.org/ci/job/mediawiki-core-code-coverage/>

2) RecentChangeTest::testIsInRCLifespan with data set #0 (6000, 1490019080, 0, true)
   Failed asserting that false matches expected true.

3) RecentChangeTest::testIsInRCLifespan with data set #3 (3000, 1490016080, 6000, true)
   Failed asserting that false matches expected true.

Change-Id: I309bb229542f3af62e3e83025d88e77ecb55cd31
2017-03-20 22:14:30 +00:00
Kunal Mehta
61adc1e146 Use namespaced ScopedCallback
The un-namespaced \ScopedCallback is deprecated.

Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4
2016-10-17 15:46:05 -07:00
Paladox
6164423de0 Update mediawiki/mediawiki-codesniffer to 0.7.1
This also fixes some code style errors.

This also include a performance increase in running phpcs, performance
increase was done by addshore :).

Change-Id: I74a3d3134791ac22c332bb4fa0bc5c3662599394
2016-05-07 07:24:04 +00:00
WMDE-Fisch
b7221eaa08 Hide hiddencat catwatch changes in special changelists
If a hidden category has a member added or removed
this will only be shown to users that have the user
preference "display hidden categories".

Also added method to WikiCategoryPage to check
for hidden status.

Added unit tests for both.

Bug: T127944
Change-Id: Ic53d51391fa29d5e18fef4c42b8a275816c7ba4a
2016-04-18 16:41:26 +02:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
addshore
2fb2a3f14b Introduce CategoryMembershipChange
This is split from:
I03516bb34144d95e5f25c46ae98ab70ce699b31b

Change-Id: I27539d25ef3e81cf991657dffc0a62b9719d21d8
2015-09-29 23:59:34 +01:00
addshore
349ca056b7 Move LogFormatter test comment block
This was missed in:
https://gerrit.wikimedia.org/r/#/c/239783/
Ia5016c82c00dd7c35a6f1253d6e385b587ec485e

Change-Id: Ibf537aaca2a0ca9d2c509499f6da5b9e51b06037
2015-09-25 15:36:06 +00:00
addshore
9da83220b8 Add tests for RecentChange::parse(To|From)RCType
Change-Id: I60278aaeef475ed3ec1515b1f5f28d6afcc700c5
2015-09-21 14:19:54 +00:00
addshore
9705da62e1 Add test for RecentChange::newFromRow
Change-Id: I1e21d296e15c1b6d18f19ae9cc7038387c8f4e2b
2015-09-21 14:19:48 +00:00
addshore
9d144409b7 Add test for RecentChange::isInRCLifespan
Change-Id: I0eac57d0cfabba3ed9b5b430e9972e7c5c0b9f8b
2015-09-21 14:19:28 +00:00
addshore
0b81487c21 Use setUp instead of __construct in RecentChangeTest
Change-Id: Ia0d704a2832c54995fba0014ae6422765a743be0
2015-09-21 13:33:50 +00:00
addshore
829d1a4c15 Cleanup RecentChangeTest, move things out that don't belong
This moves out a bunch of stuff that doesnt
seem to test anything in RecentChange....

This also shows us how few tests RecentChange
actually has!

Change-Id: Ia5016c82c00dd7c35a6f1253d6e385b587ec485e
2015-09-21 14:33:10 +01:00
umherirrender
3964b4cc05 Migrate move protect log to new log system
Migrate the move protect log as first sub type of the protection log,
because it does not have complex log parameter, which needs some way of
handling/migration.
It also keeps the gerrit change smaller and hopefully makes review
easier.
The other sub types of the protection log will be migrated in a later
patch set.

This allows use of gender on Special:Log. Old message is kept for use
in IRC. A test was added to ensure an unchanged IRC message.

Bug: T47988
Change-Id: I57b3bd8a7dc823acdbb56520d2364f5542283373
2015-08-18 22:20:35 +00:00
Stephane Bisson
62961558a5 Encapsulate rc_params handling in RecentChange::parseParams
* Make MachineReadableRCFeedFormatter use it

* Some unit tests

* Also fixed some line-too-long warnings in RecentChange.php

Change-Id: I443d14f5d4cdac0945cb9c03608d55745bbb865b
2015-06-10 15:11:37 -04:00
umherirrender
4e34450dca Add test for IRC line for legacy type block/block
Follow-Up: I08aea8399ce766e98c1a76e237169f220c6cc751
Change-Id: I8626e8ce28104d20a6145d47e647ef0ad86b3523
2015-05-01 18:14:22 +00:00
umherirrender
302dcdf19f Add test for IRC line for type protect/move_prot
All other log types already have a test, just move_prot is missing.

Change-Id: I97fdb21d3cb58847a883917b06294bc92dac9410
2015-04-08 12:12:15 +02:00
umherirrender
4f60a37d4e Migrate import log to new log system
There is no need for an extra formatter class, because at the moment
there is nothing extra to format.

This allows use of gender on Special:Log. Old messages are kept for use
in IRC. A test was added to ensure an unchanged IRC message.

The new log message for import-interwiki is used from
I3ca8b21bce49b41cac7109efb8056ca4469b88d7 to avoid "transwiki jargon".

Bug: T57404
Change-Id: I590075b203548c071a98c1eaa4b1bc9250f60e22
2015-03-18 13:21:52 +00:00
umherirrender
c891ff00ed Migrate block log to new log system
This allows use of gender on Special:Log.
Old messages are kept for use in IRC.
A test was added to ensure an unchanged IRC message.

Bug: T57402
Change-Id: Ibc7fcaa5a952ff90d42a6477da4baa429f3de64b
2015-02-07 21:02:10 +01:00
umherirrender
52f5634ba0 Migrate merge log to new log system
This allows use of gender on Special:Log
Old message is kept for use in irc,
a test is added to ensure a unchanged irc message.

Change-Id: I0557a0d2751540cf0d7967333ffd767b934011c6
2014-10-21 16:49:06 +00:00
umherirrender
092cd8ee31 Fixed some @params documentation (tests)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: Ic8aaf0a93796b97d0fa4617c1f86ff59f4b36131
2014-04-17 20:43:42 +02:00
Siebrand Mazeland
6073f19e12 Fix CodeSniffer errors and warnings in changes tests
Follow-up to 1c6b7c7485.

Change-Id: Ib42621a03a43487d94ff1cb755544823a8adda9c
2014-03-12 18:08:59 +01:00
aude
d0aba5ed4a Move RecentChangeTest to subdirectory
matches location of class within includes

Change-Id: I78d3212032ded3deaeef93aaca4d575a35559990
2013-11-18 16:45:15 +01:00
Renamed from tests/phpunit/includes/RecentChangeTest.php (Browse further)