Commit graph

10749 commits

Author SHA1 Message Date
Brad Jorsch
a2d2ccc8c5 ApiParse: Fix handling of pageid + redirects when passed a non-redirect
The setting of $pageParams in that code path was assuming the page was
specified by title, breaking when it was passed a pageid.

Bug: T241362
Change-Id: Ia5b34ee392c94e5ae7693e95b58806c1dac2b24e
2019-12-23 09:24:17 -05:00
jenkins-bot
9957c9cd67 Merge "SlotRoleRegistry: role names are case insensitive" 2019-12-20 12:51:25 +00:00
daniel
f601f0c9e5 SlotRoleRegistry: role names are case insensitive
This ensures that slot role names are consistently treated
as case insensitive. Previously, role names were converted to
lower case when stored in the database, but not when registering
or looking up a handler. This could result in spurious errors,
e.g. when the name used for registration was not lower case.

Change-Id: I15db141266d7f4efce3da54dd661b3418a7bb41d
2019-12-20 11:49:46 +00:00
Timo Tijhof
fafc4e6208 benchmarks: Exclude from PHPUnit test coverage (part 2)
Follows-up 8373f51cb0 which applied this change to
"/phpunit.xml.dist", which is only used by 'composer phpunit',
whereas the CI coverage jobs use phpunit.php.

Change-Id: I35ad4db9453c6020dcb9fc91cc8ca47f9e1fca26
2019-12-20 03:45:36 +00:00
jenkins-bot
f73d62d47d Merge "Add more logging to getWithSetCallback()" 2019-12-20 00:36:31 +00:00
jenkins-bot
c14a3ca034 Merge "Expand watchlist-related tests for User class" 2019-12-19 09:32:56 +00:00
jenkins-bot
2513919a52 Merge "registration: Implement lazy-loaded attributes" 2019-12-15 19:36:34 +00:00
jenkins-bot
4b05f9fbd4 Merge "Use document.body instead of 'body' as jQuery selector" 2019-12-15 19:14:15 +00:00
Kunal Mehta
d6390ba1ee registration: Implement lazy-loaded attributes
These attributes are only accessed at a time when performance isn't
critical (e.g. tests), so we can skip caching them and read each
extension.json file again when we do need them.

At the same time, we want to reduce the size of the array that we're
caching due to PHP 7 performance regressions with APC (T187154).

'QUnitModules' is the first attribute to be converted into a lazy-loaded
attribute.

Bug: T220994
Change-Id: I224cdace05dbac00ff947c41daecb74b07c967bb
2019-12-15 19:04:50 +00:00
Daimona Eaytoy
7b946ffb4b Fixes for PHPUnit 8 compat in DB suite
Once again, this fixes all issues aside from assertArraySubset.

Bug: T192167
Change-Id: I45c91dc1cf23f04140576dc66233558bb6021324
2019-12-15 00:27:54 +00:00
Daimona Eaytoy
2e02e7fdb1 Fix most PHPUnit 8 compat issues in DBless tests
This patch fixes all PHPUnit 8 compat issues in the DBless suite, aside
from assertArraySubset.

Bug: T192167
Change-Id: Iea782386509b9e579f06d63687669e14bc437fad
2019-12-15 00:24:21 +00:00
Daimona Eaytoy
f5529400cc Stop using assertContains with string haystack
This was done automatically by replacing every assertContains with
string *needle*. Then verifying the results.

Bug: T192167
Change-Id: Id8cbbf3b01e948f80046714183cc299f86be21fd
2019-12-15 00:22:44 +00:00
Daimona Eaytoy
e501bb3b50 Manual fix of the remaining assertInternalType & Co.
Bug: T192167
Change-Id: I3b8176745f49b1d4bfe6f36978b7879d546f68a9
2019-12-15 00:20:10 +00:00
Daimona Eaytoy
726f10bf5d Deprecate and stop using assertType(OrValue)
*assertType is marked as deprecated, and should ideally be removed soon
(i.e. no hard deprecation to follow)
*Most usages of assertType in core were autofixed by using I8ef556b630812aeea77c5606713f53d9af609f1b
*assertTypeOrValue was removed because only used in SiteTest
(codesearch: https://codesearch.wmflabs.org/search/?q=assertTypeOrValue&i=nope&files=&repos=)
*SiteTest::assertTypeOrFalse was removed because unused

Bug: T192167
Change-Id: Icb3014b8fe7d1c43e64a37e0bdaaffec18bb482f
2019-12-15 00:07:59 +00:00
jenkins-bot
6ca590ac53 Merge "Autofix 94 PHPUnit 8 compat issues" 2019-12-14 11:00:08 +00:00
DannyS712
6582ba0cf0 Expand watchlist-related tests for User class
Bug: T233385
Change-Id: I763c3ee7d21e686f98070211f04019040058ed38
2019-12-14 00:40:16 +00:00
DannyS712
18647a56cd Fix MediaWikiIntegrationTestCase MWException text for using pages
Should say "When testing /with/ pages", rather than "which"

Change-Id: Id2c1409358349f548fc72ac815812ed0bd2b5c47
2019-12-14 00:27:50 +00:00
Brad Jorsch
489bb4fb98 Tests for an old PHP bug in parse_url
It would get confused by URLs with a query portion but no path.

We no longer support any vulnerable versions of PHP, but it would still
be useful to have these tests.

Bug: T212067
Change-Id: I15c15161a668115d68eb2e2f8004826b47148fc1
2019-12-13 11:24:52 -05:00
Daimona Eaytoy
6365eaab8d Autofix 94 PHPUnit 8 compat issues
Done automatically using the master version of MW codesniffer and
running composer fix.

Bug: T192167
Change-Id: If6b40f515fde32ab5eff074a90e821c30c791827
2019-12-13 15:29:10 +01:00
Fomafix
587c003af4 Use document.body instead of 'body' as jQuery selector
Change-Id: Ie8aa67bdbd34afe0930cc6b9adfd755791607031
2019-12-13 10:09:36 +01:00
jenkins-bot
fdfa0e9a6a Merge "Fixes for PHPUnit 8 compatibility" 2019-12-11 17:07:21 +00:00
jenkins-bot
2b3b312f4e Merge "Allow specifying autoloaded classes for tests" 2019-12-10 21:55:14 +00:00
mainframe98
ac48c84224 Allow specifying autoloaded classes for tests
This introduces two new keys to the extension schema, analogous to
the existing autoloader keys: TestAutoloadNamespaces and
TestAutoloadClasses.

The classes and namespaces defined by these keys are only loaded by
the registry when ExtensionRegistry::setLoadTestClassesAndNamespaces
is called. The phpunit wrapper does this in PHPUnitMaintClass::setup.
The unit test bootstrap file calls
ExtensionRegistry::exportTestAutoloadClassesAndNamespaces instead,
similar to how it loads the regular classes and namespaces.

Bug: T196090
Change-Id: I88cf69663362fd599c20649b1df641907a02678d
2019-12-10 21:39:30 +00:00
Daimona Eaytoy
7c9e3db1e6 Fixes for PHPUnit 8 compatibility
Bug: T192167
Change-Id: Ic14f5debc53e55d67146dc96279d26dfd52b4000
2019-12-10 17:02:06 +00:00
Max Semenik
eb3461d146 ApiQueryBlocksTest: fix assertions
arrayHasKey() only returns a constraint, an assertion is
needed to actually perform a check.

Change-Id: I33a6cc4ed8e002764438a23300c5d204649200ca
2019-12-10 16:39:50 +03:00
DannyS712
57da102b90 LanguageNlTest: Split test and data provider
Per inline @todo tag, split the test

Change-Id: I38f01c2215b9ba09d6af117ae70b242de362b51f
2019-12-10 03:58:42 +00:00
Max Semenik
010f859fb8 Add tests for Language::firstChar()
Change-Id: I7d370fe5c9f5b035d9346a22a4900b9030b7d76d
2019-12-09 21:29:28 +03:00
jenkins-bot
554feecbb4 Merge "Inline diffs upstreamed from MobileFrontend to core." 2019-12-08 09:01:48 +00:00
Umherirrender
4680496455 Set visibility on PermissionManager RIGOR_ constant
Use the constant instead of strings in some places

Change-Id: Ic14456ec9e863def05ec4dfbccb2fa8bd828e639
2019-12-06 22:18:01 +01:00
jdlrobson
1c2de3d397 Inline diffs upstreamed from MobileFrontend to core.
A new inline mode is provided for diffs.
It is only available when wikidiff2 is installed.
There is no PHP implementation (one can be added later if
necessary)

For now, it is accessed by passing diff-type as a query string parameter
e.g ?diff-type=inline
A control for switching between the two is added as a follow up.
see Ie9bb17789d90b7492559782021937f3f3e4356f8

* The final method getSlotDiffRenderer now takes a second parameter
options
* The method `getSlotDiffRendererInternal` is deprecated and
replaced with the more flexible `getSlotDiffRendererWithOptions`
This has potential to be a breaking change but is unlikely to impact
any existing clients.

Note: PHP implementation can be added later if necessary

Bug: T117279
Change-Id: I4f81c8ccf253dd4aa6cf43c3fad257b4b0dd1ebd
2019-12-06 01:08:10 +00:00
jenkins-bot
f7de1a6d98 Merge "resourceloader: Add tests for module-level 'noflip' option" 2019-12-05 00:39:07 +00:00
jenkins-bot
f669615d9f Merge "resourceloader: Use ConvertibleTimestamp and Logger directly" 2019-12-05 00:38:11 +00:00
Timo Tijhof
9c0dee3965 resourceloader: Use ConvertibleTimestamp and Logger directly
Avoid use of wfTimestamp and wfDebugLog global functions.

Also simplify some of the error messages around processing of
'packageFiles' definitions and throw generic LogicException
instead of MWException.

Change-Id: I55ce1f107f53dfdfe673cbe4411b0a7c4e24b2ea
2019-12-04 16:24:40 -08:00
jenkins-bot
8f049f3dc9 Merge "ActorMigration: Improve getWhere() handling of $users" 2019-12-04 21:39:29 +00:00
jenkins-bot
fde4381fc0 Merge "Remove hacks for lack of index on rc_this_oldid" 2019-12-04 21:39:22 +00:00
Brad Jorsch
531399f5c7 ActorMigration: Improve getWhere() handling of $users
Some callers, when provided an invalid user name, will wind up passing
null or false. This raises a PHP warning and winds up treating it as the
empty array. In this case, it seems best to DWIM and continue that
behavior without the warning.

At the same time, let's more explicitly reject other values for $users.

Bug: T239772
Bug: T207217
Change-Id: I6027481f6cad222369911d5053fecc06c92b36ea
2019-12-04 16:00:02 -05:00
Brad Jorsch
152376376e Remove hacks for lack of index on rc_this_oldid
In several places, we're including rc_timestamp or other fields in a
query selecting on rc_this_oldid because there was historically no index
on the column.

The needed index was created by I0ccfd26d and deployed by T202167, so
let's remove the hacks.

Bug: T139012
Bug: T239772
Change-Id: Ic99760075bde6603c9f2ab3ee262f5a2878205c7
2019-12-04 16:00:02 -05:00
jenkins-bot
d6451a8993 Merge "MCR tests: drop MCR fields when testing old schema" 2019-12-04 18:42:58 +00:00
Moritz Schubotz (physikerwelt)
5e3a0e7395 Mimic CURLOPT_POST in GuzzleHttpRequest
The MWHttpRequest is implemented by the
CurlHttpRequest class and also the
GuzzleHttpRequest class. However, curl based rendering set
the CURLOPT_POST which implies that the 'Content-Type'
header defaults to 'application/x-www-form-urlencoded'.
To homgonize the functionality this patch mimics the
curl behaviour in Guzzle.

Bug: T232866
Change-Id: Id60a8de18e5f1e750a3bde23bd8b0deca4071165
2019-12-04 16:02:32 +00:00
jenkins-bot
de0c7071dc Merge "Do not run wfEscapeWikiText on array in Status class" 2019-12-04 08:47:43 +00:00
daniel
40fb8bcdc9 MCR tests: drop MCR fields when testing old schema
This fixes an inverse logic bug that causes tests to fail on
installations that do not have the pre-MCR fields in the database.

Bug: T238958
Change-Id: I4817b868adec4385ed99e33ad48e94e751f7e4cb
2019-12-03 23:20:40 +01:00
jenkins-bot
429b8ce473 Merge "RevisionStore: force "Unknown user" instead of empty user name" 2019-12-03 20:55:56 +00:00
Timo Tijhof
3e6db51725 resourceloader: Add tests for module-level 'noflip' option
Also widen up @covers for the integration tests to let the
coverage percentage increase from those.

Change-Id: Ib9d42b124774b4c968c52f34e587059c63e8ffc2
2019-12-03 15:58:36 +00:00
MaxSem
4ebf0c48a2 Fix MWExceptionHandlerTest on PHP 7.4
A new undocumented INI setting introduced in 7.4 made stack traces not
include function arguments with default production configuration:

https://github.com/php/php-src/commit/0819e6dc9b4

Bug: T233012
Change-Id: I6064dab7fe2d1439284082bbb6f56b84a0c7717d
2019-12-03 03:52:03 +00:00
jenkins-bot
be629bf6e8 Merge "Sync up with Parsoid parserTests.txt" 2019-12-02 19:37:30 +00:00
Subramanya Sastry
f8f31ba170 Sync up with Parsoid parserTests.txt
This now aligns with Parsoid commit ca588b2507926531d1b9c3d4936d641893ec0084

However, "Links 16. Link prefix using unicode \x{...} escapes (T235563)"
was altered (s/1923/Nineteentwentythree/) to account for Postgres not
being able to handle a page_title as an int.

Bug: T239645
Change-Id: I5c4a45d535965353f6b7ef33bfd0b858c91e36a3
2019-12-02 13:58:15 -05:00
jenkins-bot
748110478c Merge "Show the PHPUnit help in phpunit.php --help" 2019-12-02 17:59:29 +00:00
jenkins-bot
dce7e7c384 Merge "Remove duplicate variable name from class property PHPDocs" 2019-12-02 16:09:39 +00:00
Thiemo Kreuz
78ca9eff4a Remove duplicate variable name from class property PHPDocs
Repeating the variable name doesn't do anything. Documentation
generators don't need it. It's more stuff to read that doesn't add new
information. And it can become outdated.

Note there are two types of @var docs. When used inline (and not on a
class property) the variable name is needed.

Change-Id: If5a520405efacd8cefd90b878c999b842b91ac61
2019-12-02 12:58:29 +00:00
Umherirrender
c4d4d81ae4 Do not run wfEscapeWikiText on array in Status class
Message params could be more complex than a string
For example by use of Message::numParam()

Bug: T237559
Change-Id: I1be2ad3f73f189f69f955d1c4e1da75652e5e8ff
2019-12-02 13:51:11 +01:00