Commit graph

1311 commits

Author SHA1 Message Date
Platonides
bbd5b3f786 Use the canonical class name: s/JavascriptContent/JavaScriptContent/
Change-Id: I95bfb8860f77d01bad027d1c2baf2d871e093758
2012-12-06 23:11:16 +01:00
umherirrender
fa1394e1a7 Add parent::setUp() to DatabaseSQLTest
1) DatabaseSQLTest::testMediaWikiTestCaseParentSetupCalled
DatabaseSQLTest::setUp() must call parent::setUp()
Failed asserting that an array has the key 'setUp'.

Change-Id: I6aa5cb09999e0cee9b36fedd9193cb5aa08914ad
2012-12-06 21:20:52 +00:00
Hashar
d36d0adde2 Merge "LinkerTest needs to set the wiki language to en." 2012-12-06 18:38:29 +00:00
Platonides
a8440314f2 LinkerTest needs to set the wiki language to en.
The localisation of Special:Contributions break the
testUserLink otherwise.

Change-Id: I25a40356a96e03975d8ceca975449f7b064bca2b
2012-12-06 18:53:43 +01:00
Aaron Schulz
fb8e4beca3 Merge "While testing, turn off DataBase::ignoreErrors." 2012-12-06 17:38:21 +00:00
daniel
abf22b914a While testing, turn off DataBase::ignoreErrors.
Database errors should cause an exception, not return false,
unless the test case, or the code under test, explicitely calls
ignoreErrors(true). The DB object should be reset to fail fast
and safe for every test.

Change-Id: Ifc2a720ec46a1843d9ffb1488c54743a0099ef9d
2012-12-05 17:13:21 +01:00
Antoine Musso
5b9f76aef7 test: detects parent setUp not being called
Our test classes often overload MediaWikiTestCase::setUp() but forget to
call their parent. This patch makes MediaWikiTestCase to flag whenever
its own setUp() is called and then simply assert it got called. Any
class failing the assertion is missing a call to its parent setup which
is easily fixed by adding: parent::setUp().

It would be nice to find a similar trick for tearDown().

Change-Id: Ia2afed6052eb3863d6c8e68c551cf03b33bb4be9
2012-12-05 16:44:41 +01:00
Krinkle
25a01802d1 Merge "(bug 42638) Fix API action=options&reset=1 & unit tests" 2012-12-04 00:22:21 +00:00
Antoine Musso
bd6f3ddc6f test: raise timeout for DatabaseSqlite
DatabaseSqliteTest does file access and hence needs a slightly higher
timeout in PHPUnit.

Change-Id: I4b5eb7d7c5a3b9d4790f11cdb4efa9f578763183
2012-12-03 09:18:43 +01:00
Antoine Musso
2faf797e3a test: raise timeout for ExifRotation
ExifRotationTest does file access and hence needs a slightly higher
timeout in PHPUnit.

Change-Id: I871c4a4fde5e71708e55b3f28e7267e1023c2df5
2012-12-03 09:18:32 +01:00
Brad Jorsch
fb7c95f567 (bug 42638) Fix API action=options&reset=1 & unit tests
Change I98df55f2 broke action=options&reset=1, causing it to return an
error "No changes were requested" rather than resetting the options as
it should. Unfortunately, that change also broke the unit test that
would have caught this regression.

This changeset fixes the bug and the unit tests.

Change-Id: I7fe63640d54efab4572538e9d08f5b75c61243a4
2012-12-02 23:22:18 -05:00
Nikerabbit
89bb9a7920 Merge "Added assertException method to MediaWikiTestCase" 2012-11-30 16:25:01 +00:00
jeroendedauw
ba9a170df2 Added assertException method to MediaWikiTestCase
Change-Id: I3ce667b4405241c66c5a979863d1cea2cf39956b
2012-11-30 11:35:08 +01:00
Catrope
fe45ba8752 (bug 42202) Validate preference values in action=options
Previously, there was no validation whatsoever and the module would
happily write any preference you asked it to. This, combined with the
fact that the code using the 'editfont' preference didn't perform any
validation or escaping, led to a CSS injection vulnerability.

Using Preferences::getPreferences breaks some existing test cases
because a MockUser doesn't have groups for preferences.

Change-Id: I98df55f2b16ac1b6fce578798b6f58b5dad96775
2012-11-29 16:42:56 -08:00
Ori Livneh
55e064e3f8 Merge "Fix typo (sentances => sentences)" 2012-11-27 23:29:06 +00:00
Ori Livneh
237207bf0e Fix typo (sentances => sentences)
Change-Id: Ifaec0d0bd24703dbe80ab1869366b404aa001cce
2012-11-27 15:27:45 -08:00
Platonides
6e20a8c245 Fix $wgHtml5 case. Follow-up c35304 (0473c33)
Change-Id: Ie5916a5fbb64873adb0ed8a6fdd0aca666c7ebf1
2012-11-27 18:47:30 +01:00
Demon
c4d0ce4852 Merge changes Idfc2e2b6,I9b30d602
* changes:
  $wgHTML5 is a different variable than $wgHtml5 and the right name is the later.
  Global tweaks wrt $wgSecureLogin.
2012-11-27 17:18:21 +00:00
Hashar
d6f76e6858 Merge "Fix data type for timestamp in TestORMRowTest" 2012-11-27 10:04:22 +00:00
Nikerabbit
eeb3ffdd04 Merge "Removal of unused globals." 2012-11-27 07:05:44 +00:00
csteipp
ebc73c7df7 (bug 36780) Improve display of IPv6 addresses
Also add partial tests for Linker::userLink()

Change-Id: I680a59bb0ec3ca1d85ed12b0debb3446c73a3aab
2012-11-26 23:00:33 +00:00
Platonides
0473c33ecb $wgHTML5 is a different variable than $wgHtml5 and the right name is the later.
Change-Id: Idfc2e2b61a791a2d9d6a33cbffe2fc12054e22d8
2012-11-26 22:34:40 +01:00
Platonides
84e1e6b5ae Removal of unused globals.
Change-Id: I870665d18f955a245222cfceca4665897277e7e4
2012-11-26 22:15:11 +01:00
awjrichards
720a682425 Merge "Kill DeviceDetection" 2012-11-26 20:57:11 +00:00
Antoine Musso
bc77c6376f mark ApiEditPageTest as being slow tests
The edit conflict tests can take quiet a while to execute, definitely
more than the default 2 seconds we allocated to test. Marking the class
with '@group medium', in the comment, instructs PHPUnit to apply a
timeout of 10 seconds.

Change-Id: Icdd78ea43c91eeca7d4a00bfe6bb368bb3b8f891
2012-11-26 14:49:52 +01:00
umherirrender
83f883c7cb Fix data type for timestamp in TestORMRowTest
1) TestORMRowTest::testConstructor with data set #0 (array('Foobar',
'20120101020202', 42, 9000.1, true, array(13, 11, 7, 5, 3, 2),
stdClass), true)
Failed asserting that 2147483647 matches expected '20120101020202'.

Change-Id: I4dddaedf4e386c2061ee79fe0ab18af59033f052
2012-11-23 13:50:43 +01:00
Hashar
289c407957 Merge "Add MediaWikiTestCase::checkHasDiff3 and use it" 2012-11-23 10:27:47 +00:00
daniel
e2bb376dd7 Added profiling to test runner.
MediaWikiTestCase now calls wfProfileIn/wfProfileOut for each call
to a test function. This makes it easy to track down slow tests.

Change-Id: I5ff2fea957c082f41da37936fe44948ad006f573
2012-11-22 19:34:32 +01:00
umherirrender
9b3292e31a Add MediaWikiTestCase::checkHasDiff3 and use it
Some tests can only passed, when diff3 is enabled on the wiki, when not
the tests should marked as skipped. To avoid code duplicates inside
the test folder for the check, if diff3 is enabled, the new function
MediaWikiTestCase::checkHasDiff3 can be used.

Change-Id: Ie765da49a4a1358da78a3506e38772d61bcd010c
2012-11-22 17:45:50 +01:00
Aaron Schulz
2e0e6a0013 [FileBackend] Added back ability to delete file HTTP headers.
* This partially reverts b80bd6159b.
* Clarified 'headers' parameter documentation a bit.
* Added the "describe" function wrappers that the other ops have.

Change-Id: I7142fd4d973f5f3407d244a4cae793934083bc26
2012-11-21 05:30:27 +00:00
Jan Gerber
b80bd6159b [FileBackend] Added support for changing headers on existing objects.
* Added a 'describe' file operation type to doOperations()/doQuickOperations().
  This can be used by scripts to fill in headers like X-Content-Duration for
  files that already exists.
* Removed wrong comments about removing headers (they don't get removed with null).
* Added some quick unit tests.

Change-Id: I43c5907b59421beaa9487eefac0cdbf8bc6c6d85
2012-11-20 16:07:28 -08:00
Nikerabbit
c5b4135659 Merge "Always return something nice in Language::translateBlockExpiry()" 2012-11-20 17:22:23 +00:00
Liangent
c50cd60069 Always return something nice in Language::translateBlockExpiry()
Change-Id: I30a1950df5ae018cb9124392dc8d6e99ca3b98b8
2012-11-21 00:01:35 +08:00
Timo Tijhof
5f41c8ba87 (bug 40632) Remove CleanupPresentationalAttributes feature
Removed $wgCleanupPresentationalAttributes, the associated
code it toggles and references to those in src and tests.

Also fixes bug 40329.

This was originally introduced in r94465 (released in REL1_19) but
disabled by default. Then enabled in r98053, after which several
bugs were filed and eventually the decision was made to remove
this feature.

Removed obsolete release-note entry, as this is to be backported
to REL1_20.

Change-Id: I4e86305520a3b22ef88381caab55d24abac932e3
2012-11-19 22:09:17 +01:00
Hashar
34a65359cc Merge "Log profiling data when tests have finished." 2012-11-19 13:12:16 +00:00
Hashar
c9e7b3bbd5 Merge "Clean up database cloning for tests." 2012-11-19 13:04:40 +00:00
Daniel Friesen
e47082d6c2 (bug 39067) Add support for HTML5 <mark> element.
* whitelist <mark> in tidy and sanitizer
* provides a default styling for mark elements

Change-Id: I23fc2fc558ff0590be04771ef1e75fcfdf240aac
2012-11-19 09:22:48 +01:00
Alexandre Emsenhuber
44e68ac4f7 RecentChangeTest now uses 'colon-separator' msg
LogFormatter uses "colon-separator" message instead of an hardcoded
string. Since the RecentChangeTest use hardcoded colon, tests would
break whenever the message in the site language is not exactly the same
as the english version.

Change-Id: I6360584caff53fda0b2688964ae614bc9fdcc97e
2012-11-17 10:00:45 +01:00
Alexandre Emsenhuber
07818096df (bug 35204) set wgLanguageCode in unit tests
Setting $wgContLang without changing $wgLanguageCode accordingly is a
very bad idea.

This caused about 20 exceptions when using LanguageCode set to 'fr'
on my installation:

"MWException: Error in MediaWikiLangTestCase::setUp(): $wgLanguageCode
('fr') is different from $wgContLang->getCode() (en)"

Follow-up of I2987db68 (2b0edc8).

Change-Id: I56d3f1bfc78d6a2e40460533524e82f360490206
2012-11-17 09:53:34 +01:00
umherirrender
9d6977cdbd Delete more thumbnails after (new) parser tests.
Same as I0a0e757a only for the new parser tests (under phpunit)

Change-Id: If2198676da7e8a621d02227b42da0713f67a1de0
2012-11-16 23:28:39 +01:00
umherirrender
9e504dd8e6 Unset DirectoryIterator in the FileBackend
This is necessory to close all handlers on the directory and than it is
possible to rmdir the directory without a 'permission denied' on a
windows machine.

Corresponding unit test failure:
1) FileBackendTest::testRecursiveClean
Dir mwstore://localtesting/unittest-cont1/e/a no longer exists
(FSFileBackend).
Failed asserting that true matches expected false.

Change-Id: Ide58c6d0ec101bf0ddcd6b7414c51075fc28825b
2012-11-16 12:55:22 -08:00
daniel
e606537090 Log profiling data when tests have finished.
Previously, no profiling data was recorded from unit test runs.
That made it impossible to a) use unit tests for selective profiling
of individual functions, and b) made it impossibel to profile
the tests themselves.

This change fixes this problem by calling wfLogProfilingData()
after the test runner has finished.

Thaks to Hashar for some ideas, especially the fix in GlobalFunctions.

Change-Id: Iaa295115f3c4eb3b529388dcd953fe8932448b3e
2012-11-16 20:14:29 +01:00
daniel
be39c351d4 Clean up database cloning for tests.
This change makes the operation for overlaying the wiki database
with a structurally equivalent test database statically accessible,
and adds a function to revert that operation.

This is a precondition to logging profiling info to the database
after the test run has finished.

Change-Id: I2e8335d50eefcc7a97c1cd122b509f0939eacc92
2012-11-16 19:48:33 +01:00
Anomie
f950401ed2 Merge "Regression test for detecting edit conflicts." 2012-11-16 16:56:34 +00:00
Hashar
3186f5afdf Merge "Let TextContentTest extends MediaWikiLangTestCase" 2012-11-16 15:07:25 +00:00
Hashar
c2953e21eb Merge "SearchEngineTest.php must extends MediaWikiLangTestCase" 2012-11-16 13:23:03 +00:00
Demon
4daa24f4f1 Merge "drop orm_test table on teardown" 2012-11-16 05:21:15 +00:00
daniel
1aed5382d2 Regression test for detecting edit conflicts.
Change-Id: I9f8f3850ff0d6d51f173f5be73ffcb3b64886235
2012-11-15 20:23:37 +01:00
Max Semenik
56f4c805ac Kill DeviceDetection
The project to integrate MobileFrontend into core has
been stashed for now, and this leftoff is preventing
further work on MF by creating a class name conflict.

Change-Id: I6a9a25877bf75496fb4074acc83e12b7cb8dd86a
2012-11-15 19:57:00 +04:00
daniel
cef8005d3a When returning rev content, always include model.
query=revisions can be used with rvprop=content to retrieve the
content of revisions. The contentmodel should always be included
with the content (just like the contenformat is), so the client
is able to interpret the structure contained in the content blob.

Change-Id: I67cf48f905ff83a86992e1a54f7ad0feaf2b2c94
2012-11-14 14:53:34 +01:00