Commit graph

2024 commits

Author SHA1 Message Date
Bartosz Dziewoński
4c01f8b2bc Make "/*@noflip*/ /*@embed*/" annotation work without CSSJanus hacks
This reverts most of commit 2d842f1425,
leaving only the test added in it, and reimplements the same
functionality better.

Instead of stripping /*@noflip*/ annotations in CSSJanus, which is
incompatible with other implementations that preserve it, extend
CSSMin to allow other CSS comments to be present before the
rule-global @embed annotation. (This required making the regex logic
in it even worse than it was, but it's actually slightly less terrible
than I expected it would be. Good thing we have tests!)

Bug: 69698
Change-Id: I58603ef64f7d7cdc6461b34721a4d6b15f15ad79
2014-09-23 22:47:54 +00:00
jenkins-bot
0ec17d739f Merge "Add tests for Job::toString" 2014-09-23 21:42:30 +00:00
Erik Bernhardson
c9a3ecef59 Message: Correct output of wfMessage( 'non-existent-msg' )->text()
The output of Message::text() should always be acceptable to pass into
external html escaping, such as when the response is returned over an
API request and escaped by the client side code. Calling ->text() on a
non-existent key was returning the entity encoded value which leads to
double encoding down the line, this patch fixes that oversight.

Bug: 66199
Change-Id: Ieec94d4e4c7e5c36e5e68bbf01792e96368e54e0
2014-09-23 21:06:22 +00:00
addshore
f960c2434b Add tests for Job::toString
Change-Id: I00f41808af42a198a1e45a93201dd7bb3e4d9c2c
2014-09-23 21:57:31 +01:00
jenkins-bot
39f53db7e4 Merge "Add @covers tags to SpecialPageFactoryTest" 2014-09-22 16:48:21 +00:00
Kunal Mehta
3a34ae5731 Improve coverage of MailAddress::toString()
Change-Id: I8d5a1e8f293afa03d94167b722d3078f467cf59e
2014-09-21 18:17:38 -07:00
Kunal Mehta
e35e96515b Add @covers tags to SpecialPageFactoryTest
Change-Id: I997cd4296a60eb9950f7fee0caed7a2349e07bd2
2014-09-21 18:01:27 -07:00
jenkins-bot
65f8b65bd3 Merge "UserTest: Fix edit count test which incorrectly added user to db" 2014-09-20 22:30:52 +00:00
aude
9d95be4f90 UserTest: Fix edit count test which incorrectly added user to db
Although 'added' to the database, the user name was cleared
in User::loadDefaults() and not added correctly to the database.

Then if one has BetaFeatures extension, then the test fails.
Via a hook, BetaFeatures does "User::newFromName( $user->getName() );",
that produces a null object as name is '127.0.0.1' and then
$user->getOption() fails.

loadDefaults() is automatically called by addToDatabase() with correct
parameters, so we can just remove the call.

Bug: 68626
Change-Id: Ibb5c60192eb83b2608f72b59d7705854549a5dac
2014-09-20 23:57:35 +02:00
Bartosz Dziewoński
bf1168b8cd Fix CSSJanus flipping in LESS mixins and remove broken custom LESS functions
Custom LESS functions are problematic for us for a number of reasons,
as outlined by Timo on bug 67368. We should get rid of them.

The only use case was implementing CSSMin data: URI embedding in LESS,
which used to be impossible due to lessc not preserving comments (bug
54673). However, thanks to new syntax added in f3779e06 we can insert
the annotations in such a way that the compiler won't mess with them.
The same technique is used in OOjs UI since 584ed144.

The LESS-function-based embedding implementation also meant that we
were unable to flip images for RTL (bug 66091 and friends: bug 66773,
bug 68326). The annotation one doesn't have this limitation.

Bug: 67368
Bug: 66091
Bug: 66773
Bug: 68326
Change-Id: I3062346ed63272a1c22b5df27b4cc1de2a699d9a
2014-09-20 20:28:22 +00:00
jenkins-bot
2c9194d020 Merge "Strict standards: Static function PasswordTestCase::providePasswordTests() should not be abstract" 2014-09-20 17:25:41 +00:00
Bartosz Dziewoński
a917c50220 Strict standards: Static function PasswordTestCase::providePasswordTests() should not be abstract
Caused by 96771e3a65. No idea why that
change merged successfully.

Change-Id: I946f179699a5f249b032c4c8f90a9e6d2b033f55
2014-09-20 19:17:02 +02:00
jenkins-bot
8d516bc084 Merge "UserTest: Don't rely on the behavior of unknown user options" 2014-09-20 17:13:03 +00:00
Bartosz Dziewoński
03be8f40f5 UserTest: Don't rely on the behavior of unknown user options
They are not actually expected to be preserved, although they might be.

Change-Id: I34e15f3d1e5b9b825e6fc14814c8e9a6ac151ce9
2014-09-20 18:56:31 +02:00
Kunal Mehta
b3dd0fb560 Improve test coverage of Title::isValidMoveOperation
Change-Id: Ifd81b0a894714ca94ab3e627ba83c881d96c3377
2014-09-19 19:23:19 +00:00
Timo Tijhof
96771e3a65 test: Clean up data providers that should be static
Follows-up b36d883.

By far most data providers are static (and PHPUnit expects them
to be static and calls them that way).

Most of these classes already had their data providers static
but additional commits sloppily introduced non-static ones.

* ResourceLoaderWikiModuleTest, 8968d8787f.
* TitleTest, 545f1d3a73.
  Odd unused method 'dataTestIsValidMoveOperation' was introduced
  in 550b878e63.
* GlobalVarConfigTest, a3e18c3670.

Change-Id: I5da99f7cd3da68c550ae507ffe1f725d31e7666f
2014-09-18 12:52:44 -07:00
jenkins-bot
2a44ed8140 Merge "Use qqx language for OldChangesListTest" 2014-09-18 16:07:28 +00:00
jenkins-bot
cdda40a453 Merge "Allow callback functions for creating SpecialPages." 2014-09-18 13:19:28 +00:00
jenkins-bot
c4ed6d1898 Merge "Add MultiConfig for fallback logic" 2014-09-18 13:13:39 +00:00
aude
3083146484 Use qqx language for OldChangesListTest
Change-Id: Icda9d541ea0fc929ab8b9274bbe870eb6278d2ed
2014-09-18 14:56:59 +02:00
daniel
4f0b2f4241 Allow callback functions for creating SpecialPages.
This enables factory functions to be registered for special
pages, as an alterative to giving a class name. This follows the
same rationale as Ieb85493a7765, which introduced factory functions
for API modules.

Change-Id: Ia2107dc5af7869187ba5dc02a1bef46d6801e138
2014-09-18 14:47:34 +02:00
Brad Jorsch
bba2bc6ca0 Record redirect target in ParserOptions
Since Id44d566a, the text passed to the parser when parsing a
&redirect=no page no longer contains the #REDIRECT directive. For the
benefit of extensions that want to know the redirect target from various
parser hooks, record the target on the ParserOptions object associated
with the parse.

Bug: 62856
Change-Id: Icd1da9911a43eabacbd9e9a369a8326f67f270ff
2014-09-18 06:19:31 +00:00
Kunal Mehta
412c4668f1 Add MultiConfig for fallback logic
This change adds MultiConfig and HashConfig classes,
but does not actually use them anywhere. In a future
change, we can convert DefaultSettings.php into
a HashConfig instance and use MultiConfig as the
'main' config instance.

Bug: 69418
Change-Id: I0ef2fbb86d5c27602d70240219ee08be31e2d09b
2014-09-17 15:55:04 -07:00
Jeff Janes
7e3fcc39ea PHPUnit: Add Database tags
Several unit tests access the database, but did not declare
themselves in the Database @group.  This causes
"make databaseless" to fail needlessly.  Add the
missing tags.

tests/phpunit/includes/LinkerTest.php
tests/phpunit/includes/actions/ActionTest.php
tests/phpunit/includes/specials/ImageListPagerTest.php
tests/phpunit/includes/specials/SpecialMIMESearchTest.php
tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php

Other than ActionTest.php, these also are problematic in 1.23

Change-Id: I7c1c957e2194c13e48b7ba68d7529e5d89901875
2014-09-16 18:42:27 -07:00
Brad Jorsch
e2c9d4dfa9 Improve/rename Parser::replaceUnusualEscapes
The previous implementation would unescape '&', '=', '+', and '%'. The
first three will break the URL when unescaped in the query string, and
the last will break when unescaped anywhere.

The code is now changed to treat the path, query, and fragment parts of
the URL separately when unescaping. We also escape any unsafe characters
and ensure all percent-encodings use uppercase hexits.

And since the old name is no longer accurate,
Parser::replaceUnusualEscapes is deprecated in favor of
Parser::normalizeLinkUrl.

Bug: 57909
Change-Id: I77dc308d0d016c395ad737c08cf10a7711e25bbd
2014-09-16 23:00:16 +00:00
Brian Wolff
1bb00307a8 Make generating Parser test class names more robust
This includes the extension name, and it also does much
more stringent validation. In the (now rather unlikely)
event of a duplicate name, it will append a number.

This is important, as it is very confusing when this bug strikes.
There exists extensions like CharRangeSpan which will trigger this bug.

Bug: 42174
Change-Id: Idf14b4cbdb8ec103340d48855e0361acf707b101
2014-09-16 20:38:04 +00:00
jenkins-bot
ed7ae208a4 Merge "Split BitmapHandler into two classes." 2014-09-16 08:27:49 +00:00
Yuri Astrakhan
3a28ee5acb CSS/JSON/JavaScript ContentHandler refactoring
* All content handlers that deal with code/data tend to have
English as their page language & pageview language, so moved common
code to the abstract CodeContentHandler class.

* Renamed JSONContent & JSONContentHandler into JsonContent*

Change-Id: I46819a0572ef5becc211d0d82471ff7102edaa3c
2014-09-15 08:24:15 +00:00
Brian Wolff
757a70ae0a Split BitmapHandler into two classes.
BitmapHandler has a lot of generic-ish functionality that could
be re-usable by extension classes (Such as how it organizes
$scalerParams array, or various image magick escaping methods).
However it's combined with a lot of very format specific things,
such as the shell-out call to image magick.

Try to separate out the more generic stuff into
TransformationalImageHandler. In order to do this, I also made
canRotate, autoRotateEnabled, and getScalerType non-static. No
extensions in our repo appeared to be using these methods, and they
don't really make sense to be static (imo).

In particular, I think code duplication can be reduced in
PagedTiffHandler by extending this new class. See comments
on I1b9a77a4a56eeb65.

Change-Id: Id3a8b25a598942572cb5791a95e86054d7784961
2014-09-14 22:10:37 +00:00
jenkins-bot
b82a8a080a Merge "MediaWikiTestCase: Enforce children call parent::tearDown" 2014-09-14 19:31:00 +00:00
Marius Hoch
3cbaac08cd MediaWikiTestCase: Enforce children call parent::tearDown
Can't be implemented as a test case because that's not being
run before MediaWikiTestCase::tearDown.
Also there's no parent destructor, so no need to call one.

Also fixed BagOStuffTest.

Change-Id: Ifd8659b6c8a748c6716099f8822e2c50ab51bda7
2014-09-14 21:21:40 +02:00
Kunal Mehta
eab5a7d6ef Add MailAddress::newFromUser()
And tests!

Change-Id: I5214c50855f6bc756f6d748e435ae2124b2264c1
2014-09-14 19:03:18 +00:00
Kunal Mehta
c1e9250124 Add tests for MailAddress
Change-Id: Ia192919322743854096aceb24be0fcf9b1aa32b4
2014-09-14 19:03:13 +00:00
Kunal Mehta
bf8810d6bc Split UserMailer.php into includes/mail/
Change-Id: Ic435bbdbb690028a5d34e8176522fcf4aa44fa92
2014-09-14 19:03:03 +00:00
jenkins-bot
c03f567af8 Merge "Move Config::set() to MutableConfig::set()" 2014-09-13 16:29:00 +00:00
jenkins-bot
09aa7275fa Merge "resourceloader: Condition-wrap the HTML tag instead of JS response" 2014-09-13 13:29:06 +00:00
Kunal Mehta
9382608922 Move Config::set() to MutableConfig::set()
Introduces a new interface for Config types
that are mutable. Not all Config instances
should be mutable, like MultiConfig.

Change-Id: I56e193cbbf72b7afdf551f60ea635fc347e14b3e
2014-09-11 08:26:43 -07:00
jenkins-bot
0ffba1f4a3 Merge "TitleTest: Break secure and split test into two tests with providers" 2014-09-10 20:01:36 +00:00
jenkins-bot
81a84074e4 Merge "Ignore duplicate key errors in update-keys.sql" 2014-09-10 17:20:10 +00:00
jenkins-bot
5952ea26de Merge "UploadFromUrlTest: Don't reference skins/common/ (via bits.wm.o)" 2014-09-09 19:43:08 +00:00
Timo Tijhof
9d390a09cd resourceloader: Condition-wrap the HTML tag instead of JS response
Follows-up 9272bc6c47, 03c503da22, 1e063f6078.

One can't wrap arbitrary JavaScript in an if-statement and have
its inner-body mean exactly the same.

Certain statements are only allowed in the top of a scope (such
as hoisted function declarations). These are not allowed inside
a block. They're fine in both global scope and local function
scope, but not inside an if-block of any scope.

The ECMAScript spec only describes what is an allowed token.
Any unexpected token should result in a SyntaxError.

Chrome's implementation (V8) allows function declarations in
blocks and hoists them to *outside* the condition. Firefox's
SpiderMonkey silently ignores the statement. Neither throw a
SyntaxError.

Rgular ResourceLoader responses only contain mw.loader.implement()
and mw.loader.state() call which could be wrapped without issues.
However such responses don't need wrapping as they're only made
by mediawiki.js (in which case mw is obviously loaded). The
wrapping is for legacy scripts that execute in the global scope.

For those, let's wrap the script tag itself (instead of the
response). That seems like the most water-tight and semantically
correct solution.

Had to bring in $isRaw from ResourceLoader.php, else the startup
module would have been wrapped as well (added regression test).

Bug: 69924
Change-Id: Iedda0464f734ba5f7a884726487f6c7e07d444f1
2014-09-09 15:54:16 +00:00
jenkins-bot
fa89b07738 Merge "Fix undefined argument in OldChangesList" 2014-09-09 14:30:29 +00:00
aude
9ec6c4967e Fix undefined argument in OldChangesList
Bug: 70407
Change-Id: I17bbaeaf7c9cae51e33c859867ef3a3199b68a43
2014-09-09 16:05:53 +02:00
Max Semenik
d315c3bdb3 Ignore duplicate key errors in update-keys.sql
Otherwise, reinstalls can fail.

Change-Id: Ie4f7f73152a055f9a8d69970c22795433f564b26
2014-09-08 13:29:31 -07:00
Kunal Mehta
26ded3a545 Add @covers tags to ApiModuleManagerTest
Change-Id: Iaac773576a663d2f426632ad95f94b3556ef15b2
2014-09-08 10:52:10 +00:00
Kunal Mehta
ad9bb085a6 Add ApiModuleManager::getClassName()
In cases where an extension has multiple API modules that
have the same exact factory requirements, it would let them
use the same factory function and check with the module manager
what the class name to construct should be. This is already possible
using getNamesWithClasses, but this makes it much more
straightforward.

Change-Id: I889e3e6f15907896a8df376913125d903debe984
2014-09-08 02:06:33 -07:00
jenkins-bot
d1b6cd35d4 Merge "resourceloader: Only store sources' load.php urls" 2014-09-07 23:10:33 +00:00
jenkins-bot
dbb999d5e4 Merge "Added a BloomCacheRedisTest class" 2014-09-05 21:28:00 +00:00
jenkins-bot
7ae6410f94 Merge "Add tests for User::getCanonicalName()" 2014-09-05 19:29:58 +00:00
jenkins-bot
a04d94d4f2 Merge "Improve tests for OutputPage::makeResourceLoaderLink" 2014-09-05 19:25:26 +00:00