Commit graph

5395 commits

Author SHA1 Message Date
jenkins-bot
9d1b8a59d1 Merge "ChangeTagsTest: Mark tables as "used" to avoid ID reuse" 2018-10-10 17:37:17 +00:00
jenkins-bot
8318677eee Merge "Use non-deprecated login in ApiLoginTest" 2018-10-10 15:49:04 +00:00
jenkins-bot
cc814cae88 Merge "Improve ApiLogin test coverage" 2018-10-10 15:48:59 +00:00
Aryeh Gregor
de0143015a Use non-deprecated login in ApiLoginTest
Change-Id: I62c7bfce88aeda7ec1429493e733f868887976a9
2018-10-10 11:13:05 +03:00
Aryeh Gregor
1496fd4b4e Improve ApiLogin test coverage
Coverage is 100% except for one session-related bit that seems a bit
involved to test right now.  It looks like it will be easier once
SessionManager becomes a service.

I removed the third parameter from the return value of
canonicalizeLoginData, since af37a4c7 made it always return true.

I also removed three lines of dead code from ApiLogin.php.

Change-Id: Ia0073eddd27c82827518e0031e3c313f83cfd7cc
2018-10-10 11:11:43 +03:00
jenkins-bot
08911f6674 Merge "Hard-deprecate authentication-related hooks deprecated by AuthManager" 2018-10-10 05:54:03 +00:00
jenkins-bot
cf6fb41666 Merge "Re-namespace RevisionStore and RevisionRecord classes" 2018-10-10 05:16:45 +00:00
Kosta Harlan
5685904a11 Tests: Simplify badaccess group check for patrol action
The important part of the assertion is badaccess-groups, so we can drop the
other components and simplify the test code, plus also work around database
name issues that caused Travis CI to fail.

Bug: T206130
Change-Id: I137be892a611cd1f2d61baa77ad9528659587adf
2018-10-10 03:59:53 +00:00
Gergő Tisza
efa7a92e7c
Hard-deprecate authentication-related hooks deprecated by AuthManager
Hard-deprecates AbortAutoAccount, AbortNewAccount, AbortLogin,
LoginUserMigrated, UserCreateForm, and UserLoginForm.

Change-Id: Ibb267def9c295997ef71d820ff482e1e6a816873
2018-10-09 18:13:21 -07:00
Brad Jorsch
9f60798508 ChangeTagsTest: Mark tables as "used" to avoid ID reuse
If ChangeTags::updateTags() isn't passed all three of $rc_id, $rev_id,
and $log_id, it attempts to look up proper values from the subset that
is passed.

Some of the tests in ChangeTagsTest blindly use certain IDs, expecting
them to either not exist in the relevant tables or at least to be sane
(e.g. the same log_id isn't used on multiple rc_id rows). Depending on
the exact behavior of previous tests, this expectation may not hold.

The simple fix is to just mark the relevant tables as "used" by
ChangeTagsTest so MediaWikiTestCase will truncate them.

Change-Id: Ie60092b8a6e50f6f8a5cfdaaf4cac8ddb4fc6f53
2018-10-09 15:52:05 -04:00
jenkins-bot
5ab9496031 Merge "Clean up ApiLoginTest" 2018-10-09 19:17:20 +00:00
Aryeh Gregor
8435e0907b Clean up ApiLoginTest
Change-Id: Icd77f8a5ee0c26cfbd3cc8f220412cfa1bf49d60
2018-10-09 20:04:58 +03:00
Brad Jorsch
dff469a408 Re-namespace RevisionStore and RevisionRecord classes
During development a lot of classes were placed in MediaWiki\Storage\.
The precedent set would mean that every class relating to something
stored in a database table, plus all related value classes and such,
would go into that namespace.

Let's put them into MediaWiki\Revision\ instead. Then future classes
related to the 'page' table can go into MediaWiki\Page\, future classes
related to the 'user' table can go into MediaWiki\User\, and so on.

Note I didn't move DerivedPageDataUpdater, PageUpdateException,
PageUpdater, or RevisionSlotsUpdate in this patch. If these are kept
long-term, they probably belong in MediaWiki\Page\ or MediaWiki\Edit\
instead.

Bug: T204158
Change-Id: I16bea8927566a3c73c07e4f4afb3537e05aa04a5
2018-10-09 10:22:48 -04:00
jenkins-bot
dfd526b37e Merge "Make RefreshLinksJob MCR compliant." 2018-10-09 02:28:04 +00:00
jenkins-bot
bc8571cca2 Merge "Revert "Re-enable tests from TitlePermissionTest"" 2018-10-09 01:44:03 +00:00
Krinkle
ae4476c54d Revert "Re-enable tests from TitlePermissionTest"
It's still broken, and 4 days passed with broken Travis CI builds.
Re-reverting for now.

This reverts commit 589741b541.

Change-Id: I85a0b02d3f32303a90118e2705a7b2afc721cb57
2018-10-09 01:21:00 +00:00
jenkins-bot
5cc5250c26 Merge "Make SpecialPageTestBase always call parent::tearDown" 2018-10-08 19:17:39 +00:00
jenkins-bot
88ecea4991 Merge "Suppress "Headers already sent" in PHP 7.2 too" 2018-10-08 18:17:44 +00:00
daniel
6248556b5e Make RefreshLinksJob MCR compliant.
So far, RefreshLinksJob re-generated the ParserOutput ba calling
Content::getParserOutput. This only works for the main slot. It
needs to instead get the parser output for all slots combiend,
by using RevisionRenderer and RenderedRevision.

Bug: T174035
Change-Id: I253dda26bfa5aefa15f8b1dcc59e69fc7e9d0cb7
2018-10-08 19:20:13 +02:00
Aryeh Gregor
1572f3b1b8 Suppress "Headers already sent" in PHP 7.2 too
The "h" is now capitalized, so we need to update the regex.

Change-Id: I1111e1228868ec66d930c7a3b0d7972e5c6356b9
2018-10-08 20:10:36 +03:00
Aryeh Gregor
0a5fc8dcc6 Make SpecialPageTestBase always call parent::tearDown
Change-Id: Ifc244d5117e7da4bf46cdf273eca9fc4ae5c3a42
2018-10-08 19:54:32 +03:00
jenkins-bot
862fb6e168 Merge "Improve ApiFormatJson test coverage" 2018-10-08 16:03:07 +00:00
Aryeh Gregor
edb52e7338 Improve ApiFormatJson test coverage
The only thing missing is tests for the rawfm paths, which I don't
understand well enough to test easily.

Change-Id: I08779391798b9d2d5eeb7e19ec4764059336069c
2018-10-08 13:42:20 +03:00
Aryeh Gregor
09eee138e1 Deprecate MediaWikiTestCase::stashMwGlobals
This method encourages directly editing configuration variables.  It's a
better idea to use setMwGlobals() (or other set wrappers) so that we can
be intelligent in the future, for instance resetting services after the
config change.  Plus, a lot of the callers come out cleaner this way
anyway.

Depends-On: I8a1e81acc5c42a8d7f30938a72cface0acea4a70
Depends-On: I4105dbcf9c5399fe7239478c460ec57c015a98d4
Depends-On: I1b220996acf2f66cf7b0f092b341584663df32f9
Depends-On: Ie2d1ea65c0cb334bbde1666d00781474b7ac4dab
Change-Id: I23d77398e401f4986b1d5bd1c9e11a8a40da16f8
2018-10-07 19:39:47 +03:00
Alex Ezell
613e269920 Replace Media namespace redirects with File namespace
If a user creates a redirect that goes to a [[Media:example.jpg]]
page, then an exception is thrown because NS_MEDIA is a virtual
namespace. This change catches this case and changes the namespace
to an NS_FILE namespace and the redirect works correctly. This
change only happens when we are dealing with a redirect so other
uses of the NS_MEDIA namespace shouldn't be affected.

Bug: T203942
Change-Id: Ia744059650e16510732a65d51b138b11cbd43eb4
2018-10-05 18:04:24 -04:00
Aryeh Gregor
376e702942 Test ApiUnblock
Full coverage (except for the examples/help URL).

Change-Id: I4c618506b5446680f06fa9b605d3babe7194de94
2018-10-05 00:23:01 +00:00
jenkins-bot
f340c7271c Merge "ParserOutput::getCacheTime should stay the same after the first call." 2018-10-04 16:58:00 +00:00
jenkins-bot
1dde3dadc0 Merge "Ensure OutputPageTest works when Translate extension is loaded" 2018-10-04 16:53:20 +00:00
jenkins-bot
6871d732a1 Merge "Use Remex for TextContentTest subclasses" 2018-10-04 16:38:46 +00:00
jenkins-bot
96361e8866 Merge "tests: Allow string to be passed to getTestUser() etc." 2018-10-04 15:54:57 +00:00
jenkins-bot
076f262023 Merge "Minor cleanup in ApiBlockTest" 2018-10-04 15:50:51 +00:00
jenkins-bot
a4120368bb Merge "Only use "*Test.php" for actual PHPUnit tests" 2018-10-04 15:43:12 +00:00
jenkins-bot
fdce3717a1 Merge "Re-enable tests from TitlePermissionTest" 2018-10-04 15:40:48 +00:00
jenkins-bot
ca725a12bc Merge "registration: Let extensions add PHP extension requirements" 2018-10-04 15:38:58 +00:00
Aryeh Gregor
b93b18d98a tests: Allow string to be passed to getTestUser() etc.
If there's only one group, let's not require the brackets.

Change-Id: Ib46ef1facbbbf2ba01c13b8290ebbe3a8e08cb4f
2018-10-04 15:30:47 +00:00
Aryeh Gregor
c057200613 Minor cleanup in ApiBlockTest
Use tablesUsed instead of cleaning up ourselves.

Change-Id: Ibe470a8f292d65ceeaa098d5c033b8585501a9f3
2018-10-04 15:55:55 +03:00
daniel
414215ccac ParserOutput::getCacheTime should stay the same after the first call.
Previously, getCacheTime would default to the current time, potentially
causing the return value to change over subsequent calls. With this change,
the value is determined on the first call, and then remembered for subsequent
calls.

Bug: T205464
Change-Id: If240161c71d523ad5b0d33b9378950e0bebceb6e
2018-10-04 13:08:56 +02:00
Timo Tijhof
1d0e26cf83 UIDGenerator: Misc clean up
Various miscellaneous clean ups with no change to any of the
logical code. This to make the next commit have a cleaner diff
for easier review.

* Make internal millitime() non-static.

* Improve documentation and add missing @covers annotations.

* Correct getTimestampedID88() documentation to state that
  only two values need to be passed, not three.
  This is significant because the Flow extension is actually
  using this method in a subclass and passes only two values.

Bug: T94522
Change-Id: I2a0c51bea58df4cc0c253c1c10de3ac383f04c8e
2018-10-04 12:44:17 +02:00
Fomafix
1472f02b36 Phabricator: Use Tddddd instead of Bug ddddd in comments
Change-Id: Ic9fe03cab270bd6be738af346164ad5d31a0d780
2018-10-04 09:15:02 +02:00
jenkins-bot
9eb3834b89 Merge "Drop 'SpecialRecentChangesQuery' & 'SpecialWatchlistQuery' hooks, deprecated in 1.23" 2018-10-03 23:32:36 +00:00
jenkins-bot
6866617c2c Merge "Database: close() should not commit transactions" 2018-10-03 23:25:22 +00:00
Kosta Harlan
0a7c0a6797 Move test assertion to mirror parameter order
Follow up from I2df0551c5837adc578b27082ab6ba2ac95d937f8

Bug: T206130
Change-Id: Ib669c77fdb709846d0182cb28796cf53914114c4
2018-10-03 16:42:55 -04:00
jenkins-bot
12d9221ede Merge "SECURITY: Fix permissions check for patrol action" 2018-10-03 19:50:32 +00:00
Kosta Harlan
890ffc619d SECURITY: Fix permissions check for patrol action
Return existing errors instead of empty array in checkUserConfigPermissions().
Returning an empty array wiped out previously-found errors.

Also add test coverage for patrol action.

Bug: T206130
Change-Id: I2df0551c5837adc578b27082ab6ba2ac95d937f8
2018-10-03 12:07:46 -07:00
Brad Jorsch
bf30fcb714 Database: close() should not commit transactions
Transactional databases normally roll back when a connection is closed
with an open transaction rather than committing them, so MediaWiki
committing them is unexpected.

There are two cases being changed here: automatic transactions without
writes and manual transactions. For the former it shouldn't make a
difference if we commit or roll back since no writes were done anyway.
The latter has logged a message since MW 1.31 (I0992f9a8), and that
warning has not been logged in Wikimedia production in the past 60 days
so we should be ok there too.

Bug: T206147
Change-Id: Ieceef4deb49044db8f0622d38ee76c9d9f39704c
2018-10-03 14:55:43 -04:00
Aryeh Gregor
2bb3551082 Only use "*Test.php" for actual PHPUnit tests
Otherwise I get errors every time I try to run PHPUnit on includes/ or
includes/parser, because it tries to run ParserIntegrationTest.php and
fails.  Apparently the <exclude> in suite.xml doesn't work if PHPUnit is
invoked on a directory.

Bug: T201278
Change-Id: I7d09576bee2705d8516152e8fa671da8dac40233
2018-10-03 20:22:22 +03:00
Aryeh Gregor
589741b541 Re-enable tests from TitlePermissionTest
Let's see if they work now that services are reset between tests.

This reverts commit 7f843b0c04.

Bug: T201776
Change-Id: Iea7c74f8c77a97d83385b4399e500cf8129a1158
2018-10-03 15:38:45 +03:00
jenkins-bot
b3a4973cf8 Merge "Migrate image descriptions from image_comment_temp" 2018-10-03 01:23:54 +00:00
Aaron Schulz
7d2b121ac8 MessageCache: remove confusing and unused $isFullKey parameter from get()
Follows-up cba0fb1c15, which removed the last caller.

Change-Id: I00c17fedff39b1b35519cff2a0f8eac3e4d6f2ab
2018-10-02 23:34:53 +00:00
jenkins-bot
99dcd46f00 Merge "rdbms: make * consistently act like in select/insertSelect methods" 2018-10-02 16:44:54 +00:00