Commit graph

5103 commits

Author SHA1 Message Date
Brad Jorsch
e75f2ab0f2 Improve SessionManager unit test coverage, and fix two namespacing bugs
Change-Id: Ie0bcba77625e04ca3e89eb400626f63024c6e1a1
2016-02-26 20:14:27 +00:00
jenkins-bot
ae69acacf5 Merge "Remove no-op parameter from UIDGeneratorTest" 2016-02-25 17:11:58 +00:00
jenkins-bot
f26ac509db Merge "Move WatchedItem::duplicateEntries to WatchedItemStore" 2016-02-25 16:44:04 +00:00
Thiemo Mättig
0965bf5991 Add missing null type hints to Content::isCountable and implementations
Change-Id: I6e3128dddd296f6d33da23332b8ff8393837b61b
2016-02-25 14:13:22 +01:00
Arlo Breault
d13a933fee Fix parserTests: Set scriptPath in setupGlobals() as well
Follows-up to 2eeda9bc7, which only set it in setUp().

Change-Id: Ifafaeaab679f51d452419bea223a955afcc63b51
2016-02-23 22:05:34 +00:00
jenkins-bot
adf29385db Merge "Sync up with Parsoid parserTests." 2016-02-23 20:45:38 +00:00
Arlo Breault
88d7413ddf Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 239d2e60d82c736905a935525db748ebf6b45e23

Change-Id: Iec62b6824ab7d4c5d660999af130c777f8621571
2016-02-23 12:24:58 -08:00
Ori Livneh
2c1e550b6f Revert "Log multiple IPs using the same session or the same user account"
This reverts commit f22549a605.
Per T125455#2054194.

Bug: T125455
Change-Id: Ic2049381e98586e91974fc5b47d9e857a73414a4
2016-02-23 20:13:48 +00:00
jenkins-bot
7c0213066b Merge "CachedBagOStuff: cache backend misses" 2016-02-23 15:03:42 +00:00
jenkins-bot
f63acd735c Merge "Fix class name of BcryptPasswordTest" 2016-02-23 10:00:06 +00:00
Timo Tijhof
4193700b19 Add missing namespace to @covers comments
PHP_CodeCoverage_Exception:
> Trying to @cover not existing method "SwiftFileBackend::sanitzeHdrs".
> Trying to @cover not existing method "LineFormatter::normalizeException".
> Trying to @cover not existing method "MonologSpi::mergeConfig".
> Trying to @cover not existing method "ProcessCacheLRU::het".
> Trying to @cover not existing method "BitmapHandler::swapICCProfile".
> Trying to @cover not existing class or interface "checkParseSafety".
> Trying to @cover not existing method "Article::__call". (was removed).
> Trying to @cover not existing method "ExtensionProcessor::extracttExtensionMessagesFiles".
> Trying to @cover not existing method "FileContentsHasher::getFileContentHash".

Makes code coverage run fail at the moment. These used to be warnings
in PHPUnit 3.x, but are now hard exceptions in PHPUnit 4.x when requesting
a coverage report.

Change-Id: If7f45ca57fd7d480d35b1414a889398837c0c472
2016-02-23 03:56:49 +00:00
Timo Tijhof
e7939ffcd4 Add missing namespace to @covers comment in LegacyLoggerTest
> Trying to @cover or @use not existing method "LegacyLogger::interpolate"

Makes code coverage run fail at the moment.

Change-Id: I8417b5c2f1fc116583758c7507770c796127bb67
2016-02-23 03:18:31 +00:00
Timo Tijhof
2eeda9bc7d parserTest: Make $wgResourceBasePath match $wgScriptPath
Right now it forgets to reset $wgResourceBasePath, which means it
is inherited from the wikis's (or Jenkins') default settings which
is typically '/w'. That caused parser tests to behave as if pointers
to /extensions were outside /w.

Also update wgScriptPath to be '' instead of '/'. Otherwise this
can cause double-slash prefixed urls.

Change-Id: Ic455d62fca8fcac2c4ecc055cc0d7e311b70a94a
2016-02-23 02:23:05 +00:00
jenkins-bot
0e19c04838 Merge "Upgrade from PHPunit 3.7.x to PHPUnit 4.8.x" 2016-02-23 01:57:56 +00:00
Max Semenik
df4f4647e8 Fix parameter parsing in parserTests.php
Change-Id: Iafb8a60f040cd94eb1b8c30ea5ace9cff4272c0e
2016-02-22 17:45:51 -08:00
Bryan Davis
2bcf34421a CachedBagOStuff: cache backend misses
Cache misses from the backend cache the same as hits.

Bug: T127772
Change-Id: If2fe1920411b24862acea888c627db13717da8bd
2016-02-22 18:45:20 -07:00
Timo Tijhof
dbe3499113 Upgrade from PHPunit 3.7.x to PHPUnit 4.8.x
Major changes:

* (4.0.0) Limited support for stubbing and mocking static methods was removed.
          (introduced in PHPUnit 3.5)
* (4.0.0) The addRiskyTest() was added to the PHPUnit_Framework_TestListener interface.
          Classes that implement this interface MUST implement this method.
* (4.5.0) The "--strict" catch-all option was deprecated. Use specific options instead.

Notable changes:

* (4.6.0) Tests not annotated with @small, @medium, or @large are no longer default
          to matching in group @small.
* (4.6.0) Result printer now checks hasColorSupport().
* (4.8.0) The name of the default group was changed from "__nogroup__" to "default".
* (4.8.0) This is the last release to support PHP 5.3, PHP 5.4, and PHP 5.5.
          PHPUnit 5 will require PHP 5.6 or higher.

PHPUnit 3.7.17 was released March 2013.
PHPUnit 4.8.0 was released August 2015.
PHPUnit 4.8.23 was released January 2016.

Details:

* https://github.com/sebastianbergmann/phpunit/wiki/ChangeLog-for-PHPUnit-3.7
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.0.0
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.1.0
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.2.0
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.3.0
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.4.0
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.5.0
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.6.0
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.7.0
* https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.8.0

Bug: T99982
Change-Id: I70ad81513812aa76a84fa55be14135aac94d55e8
2016-02-23 00:57:48 +00:00
umherirrender
d97cc4a2f7 Fix class name of BcryptPasswordTest
Tests are named Test, not TestCase

Change-Id: I3725f8bebde5896fde24e36bd6b6e25dd8492a91
2016-02-22 18:46:57 +01:00
jenkins-bot
62ec66bb11 Merge "Use hex2bin() instead of pack()" 2016-02-22 17:18:00 +00:00
Željko Filipin
b211da1dd4 Fixed Selenium tests by removing skins not installed by default
Looks like the tests were developed targeting
en.wikipedia.beta.wmflabs.org that has 4 skins by default. The commit
removes checks for all skins but Vector, which is installed by default. (At least in
my MediaWiki-Vagrant installation.)

Bug: T94150
Change-Id: I68f864bd194dbb251acab3d94699f1e701300ab2
2016-02-22 12:46:49 +00:00
Arlo Breault
87f43fd803 Match html5 unquoted attribute parsing
* Brings us closer to the html5 attribute parsing algorithm described
   in http://www.w3.org/TR/html5/syntax.html#before-attribute-value-state

 * There's a similar patch for the Parsoid in,
   I2160a23b2a3c914eb369347bbf5d58328440041d

 * The spec says <div class=  style="123">hi</div> should parse as
   <div class="style=\"123\"">hi</div>, which it now does, whereas it
   used to yield <div class="" style="123">hi</div>.

 * Merge with caution. This is going to break pages like,
   frwikisource/La_Mirlitantouille_(Lenotre)?oldid=4669681

Bug: T108134
Change-Id: Ic2fc1b573a55a847e6c05707678b58c1189ecc52
2016-02-22 00:50:06 +00:00
Fomafix
5ce8c0a496 mediawiki.api.options: Use formatversion=2 for API requests
The format of the JSON response does not change.
But the request is different so the test also have to be updated.

Change-Id: I391a221f81fd92731c331363a8202c21d6b933b5
2016-02-20 20:52:55 +00:00
Kevin Israel
6492c009ef Use hex2bin() instead of pack()
This function was added in PHP 5.4.0 and can be used now that MediaWiki
only works with PHP 5.5.9 or higher.

Also fixed a bug in ApiQueryCategoryMembers::validateHexSortkey() that
allowed a single line feed at the end of the string to pass.

Change-Id: I5b577e7dcc5fb6a06ab550429aae657dbcc79083
2016-02-20 00:27:24 -05:00
Derk-Jan Hartman
61d078a2f5 Parsertests: Fix the video parsertests to run using phpunit
Bug: T126723
Change-Id: Ib3777413e1f86ddca9e460b41a8e3ef0eb8fb7cc
2016-02-19 18:15:54 +01:00
Fomafix
6b976d825a Update comments about language codes
* RFC 3066 is obsoleted by RFC 4646.
* RFC 4646 is obsoleted by RFC 5646.
* All are also known as BCP 47.
* Language codes must treated as case insensitive.
* There exist conventions for the capitalization of some of the subtags.
* Write a space between BCP and 47 in comments.
* http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart1.pdf is not available.
* https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2014-12/XMPSpecificationPart1.pdf
  is the new position.

Change-Id: I91e305fd5754cf4dedf8fd7460f7d3375f792c89
2016-02-19 07:31:51 +00:00
Timo Tijhof
5a3fcb0280 Timing: Fix flaky TimingTest test
> 1) TimingTest::testMark
> Failed asserting that 1455828402.4503 is greater than 1455828402.4503.

Use usleep(100), similar to the other tests already there.

Change-Id: Ic45c99b7e928df397809d872ab8e41ada6ecf1e7
2016-02-18 21:06:34 +00:00
jenkins-bot
13aa7bed1a Merge "Changed 'expiry' to American English 'expiration' in en.json" 2016-02-18 19:34:26 +00:00
Krzysztof Zbudniewek
e0b2d4a487 Changed 'expiry' to American English 'expiration' in en.json
Added British 'expiry' strings to en-gb.json.

https://translatewiki.net/wiki/Thread:Support/British_English_in_Mediawiki_messages

Change-Id: I3913449fc697770122ce01c1733f15ee3a7976de
2016-02-18 20:07:27 +01:00
Timo Tijhof
04362aa613 registration: Avoid double slashes in localBasePath
Noticed it in APC usage for ResourceLoader that various keys from
FileContentsHasher contain double slashes. All from extensions that
use the `"localBasePath": ""` trick in extension.json (e.g. Citoid).

Change-Id: I5bac1e2e05e063aa7ff251ce7ffaa965a3451db9
2016-02-18 10:25:02 -08:00
jenkins-bot
aeb7882171 Merge "CSSMin: Make isRemoteUrl and isLocalUrl really private, now that we can in PHP 5.5" 2016-02-18 08:21:35 +00:00
Bartosz Dziewoński
23fbf4aa22 Avoid parsing HTML when creating <input> nodes
We used to create them like $( '<input type="checkbox" />' ), which
actually does HTML parsing under the hood, because on IE 8 and lower
trying to change the 'type' of an <input> node throws an exception.
But we dropped support for IE 8 recently and no longer need to do that.

Upstream change for OOjs UI is I166f5ab0dce5ab47dc6a1f4e2e5ad012635911ed.

Find:         \$\( '<input type="(\w+)" ?/?>' \)
Replace with: $( '<input>' ).attr( 'type', '\1' )

Change-Id: Ie86f8917e8ce100de22006516daa542ad178aab6
2016-02-18 03:07:08 +01:00
Bartosz Dziewoński
b9903564fa ExportTest: Simplify code that failed on 5.3 because of reserved word 'namespace'
Reserved words, like 'namespace', are perfectly fine now to use as object
keys, but it seems they used to not be in PHP 5.3, necessitating workarounds.

Change-Id: Iecb79fda19803461dfb3800b8af4d31e971551b8
2016-02-17 21:23:49 +00:00
Bartosz Dziewoński
ab44c1a6f4 LinkFilterTests: Uncomment test cases that should pass on PHP 5.5
Change-Id: If62f964c3a8e0eaaab6e7193d426cc4ddaa47ade
2016-02-17 19:35:20 +00:00
jenkins-bot
a592a76edf Merge "build: Update mediawiki-codesniffer to 0.6.0, add "composer fix"" 2016-02-17 15:54:36 +00:00
addshore
54d4315be6 Move WatchedItem::duplicateEntries to WatchedItemStore
This removes static logic from WatchedItem into a
class that we can slowly fill with watchlist database
and storage things.

This also removes the dual namespace handling in
the new implementation.

Change-Id: Ia67ab1d200ac393c65013b2091e61acefcb3defb
2016-02-17 15:22:32 +00:00
Bartosz Dziewoński
1decdbce53 CSSMin: Make isRemoteUrl and isLocalUrl really private, now that we can in PHP 5.5
Well, protected, because we want to have unit tests for them, apparently.

Change-Id: I734b88599e5860aa59a07a89cc5389eb73b48813
2016-02-17 15:50:08 +01:00
Željko Filipin
88e5638e82 Browser test: fix log in Selenium tests
LoginPage is removed from mediawiki_selenium Ruby gem. This repository
is the only repository that needs it, so the file is copied here.

Also, user used to be logged in via the API, not really testing if log
in via the web site works. It is fixed now.

Bug: T127042
Change-Id: Iff85d66a9a6d3343c212fe648c589539e889a313
2016-02-17 13:09:34 +00:00
Kunal Mehta
b9668d6d80 build: Update mediawiki-codesniffer to 0.6.0, add "composer fix"
* Fix errors spotted by new release
* Introduce "composer fix", which uses phpcbf to automatically fix some
errors spotted by phpcs.
* Drop $PHPCS_ARGS variable that didn't work on Windows, and add -s flag
* Remove rules from phpcs.xml that are now in MW-CS ruleset.

Change-Id: I13e2155695918c918b67497ac65b85a03897095e
2016-02-17 02:54:42 -08: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
jenkins-bot
d8e2b67516 Merge "Session: Implement ArrayAccess" 2016-02-16 18:59:52 +00:00
jenkins-bot
f51b34c9d3 Merge "Converted ApiQueryPageProps to use PageProps; added multi-property query to PageProps." 2016-02-16 18:59:43 +00:00
Cindy Cicalese
86c08b2401 Converted ApiQueryPageProps to use PageProps; added multi-property query to PageProps.
Change-Id: Icd4540001e044052ae5759c87c8b83a70ab5c30f
2016-02-16 13:39:47 -05:00
Brad Jorsch
1aedd2df73 Session: Implement ArrayAccess
Now that we dropped support for PHP 5.3.3, we can do this.

The behavior of $session['foo'] when that key doesn't already exist is a
little unexpected (it implicitly assigns null), but it's the best we can
do.

Change-Id: Ibef878867d46591a8bf542139a1719dfec3b83ab
2016-02-16 17:33:33 +00:00
jdlrobson
94c1162400 resourceloader: Implement modern module loading (1/2)
This defines mw.loader.require() and 'module.exports'. These will
be exposed to mw.loader.implement() closures as local 'require'
and 'module' parameters.

Changes:
* This alters nestedAddScript to maintain a single queue to
  ensure scripts from different modules are never downloaded in
  parallel (used in debug mode).

Note:
A further patch will start passing module and require to module definitions.

Bug: T108655
Change-Id: Ia925844cc22f143f531216f2fe3efead08885b5d
2016-02-13 09:51:35 +01:00
Bryan Davis
db47c86bc5 Update AutoLoaderTest and ran maintenance/generateLocalAutoload.php
AutoLoaderTest didn't know about traits.

generateLocalAutoload found a  missing Trait from the autoloader and
a class map ordering issue.

Change-Id: I34bf2698ad838b6a977c9bf39f6e416330ff0e5d
2016-02-12 13:12:20 +00:00
jenkins-bot
197ee74f2b Merge "Log multiple IPs using the same session or the same user account" 2016-02-12 00:35:12 +00:00
jenkins-bot
4e0f4a3a10 Merge "Add MediaWikiTestCase convenience method for mocking a logger" 2016-02-12 00:14:07 +00:00
Bryan Davis
9750adacdd SessionProvider::mergeMetadata: Log additional data
Add the data values and types to the exception raised when mismatched
session data is processed. This is done by passing the old and new
values on via a new MetadataMergeException class. The attached data is
added to the debug logging context info when caught.

Change-Id: If8a7174399289bc284ca1b36052ba515c8857c50
2016-02-11 14:21:14 -07:00
Gergő Tisza
f22549a605 Log multiple IPs using the same session or the same user account
As an attempt to detect SessionManager errors that log people into
the wrong account, log multiple IPs using the same session, or the same
user account.

Bug: T125455
Change-Id: I27468a3f6d582d9b46984227b9307dc71190fd6a
2016-02-11 08:00:28 -08:00
jenkins-bot
04ca989e86 Merge "Add tests for LanguageConverter classes that didn't have them" 2016-02-11 04:06:00 +00:00