Commit graph

334 commits

Author SHA1 Message Date
Platonides
95f1076f20 Remove unused globals 2011-03-06 23:28:32 +00:00
Platonides
54026190a1 r82867 converted $wgCaches into a class instance. Update the parsertests.
This faking is needed to avoid Table 'unittest_objectcache' doesn't exist errors when using temporary tables.
2011-03-06 23:15:10 +00:00
Antoine Musso
16c6730b84 PHPUnit coverage comment must not have parentheses
Those comments have the format:
 @covers Class::Method

In PHPUnit 3.5.12, the comment is split by :: and method_exist called on
the resulting string. When one use  Class::Method(), the result is a call
to method_exist( 'Method()' ) which is always false and raise an exception

Removing parentheses from r79118 solve the issue. This also kind of
revert r79164.
2011-03-06 17:36:42 +00:00
Max Semenik
09756f3c1e Fixed fatals in UploadFromUrlTest. It still fails though 2011-03-06 09:01:19 +00:00
Antoine Musso
6fbd3da876 tests for IP class, mostly incompletes
* IP::sanitizeIP()
* IP::canonicalize()
* IP::isInRange()
2011-03-05 17:30:33 +00:00
Max Semenik
817ffbb6bf Fix E_STRICT 2011-03-05 16:32:32 +00:00
Antoine Musso
9ad5b773f7 Tests for bug 27854 - Http::isValidURI is to lax
Those tests are made to help someone fix bug 27854. You might want to add
some more.  Please note we want this function to only validate curl supported
URI, hence the hardcoded protocols http,https and ftp.

Some of those tests currently fail because of bug 27854.
2011-03-05 16:15:39 +00:00
Max Semenik
b11cd099bb Don't dupe/drop parts of searchindex on SQLite 2011-03-05 16:09:10 +00:00
Max Semenik
332d709d8b MediaWikiTestCase: factored prefix generation to a separate function 2011-03-05 15:44:28 +00:00
Antoine Musso
0330258617 Underscore are not valid in language code
* Reject underscore in validation
* Still case unsensitive
* Corrected tests using underscore


Follow up r83160 which was a follow up of r82927 (language code validation)
2011-03-04 17:16:09 +00:00
Antoine Musso
93348f39d4 Fix language code validation (from r82927)
A language code may contains the underscore character (be_tarask)
and might as well be upper case (FR).

Add tests for Language::isValidBuiltInCode() against some language codes
2011-03-03 19:13:57 +00:00
Chad Horohoe
b661588c1f Followup r83140: FakeMemCachedClient -> EmptyBagOStuff in tests 2011-03-03 12:55:22 +00:00
Tim Starling
be76d86932 * Rewrote ObjectCache.php to conform to the modern coding style, and to be less convoluted about how CACHE_ANYTHING and CACHE_ACCEL are resolved. Moved most functionality to static members of a new ObjectCache class.
* Moved the global functions to GlobalFunctions.php, where they are now just convenience wrappers. Made them return non-references. Updated callers (none found in extensions). 
* Added an advanced configuration method, $wgObjectCaches, which allows a lot more detail in the object cache configuration than $wgMainCacheType. 
* Made all object cache classes derive from BagOStuff. 
* Split the MWMemcached class into a generic client class and a MediaWiki-specific wrapper class. The wrapper class presents a simple BagOStuff interface to calling code, hiding memcached client internals, and will simplify the task of supporting the PECL extension.
* Added some extra constructor parameters to MWMemcached, configurable via $wgObjectCaches.
* Removed the *_multi() methods from BagOStuff, my grepping indicates that they are not used.
* Rewrote FakeMemCachedClient as a BagOStuff subclass, called EmptyBagOStuff.
* Added an optional "server" parameter to SQLBagOStuff. This allows the server holding the objectcache table to be different from the server holding the core DB.
* Added MultiWriteBagOStuff: a cache class which writes to multiple locations, and reads from them in a defined fallback sequence. This can be used to extend the cache space by adding disk-backed storage to existing in-memory caches.
* Made MWMemcached::get() return false on failure instead of null, to match the BagOStuff documentation and the other BagOStuff subclasses. Anything that was relying on it returning null would have already been broken with SqlBagOStuff.
* Fixed a bug in the memcached client causing keys with spaces or line breaks in them to break the memcached protocol, injecting arbitrary commands or parameters. Since the PECL client apparently also has this flaw, I implemented the fix in the wrapper class.
* Renamed BagOStuff::set_debug() to setDebug(), since we aren't emulating the memcached client anymore
* Fixed spelling error in MWMemcached: persistant -> persistent
2011-03-03 09:37:37 +00:00
Antoine Musso
3f8524f459 PHPUnit target 'database' for db related tests 2011-03-02 20:45:44 +00:00
Antoine Musso
2a165ac219 Bug 2429 allow selection of associated namespace in recent changes
Done by adding yet another checkbox in Special:RecentChanges. The feature
also support namespace inversion.  For example, if you have selected
the TALK namespace with inversion and associated namespace, you will
be shown any changes which is not NS_MAIN or NS_TALK.

Tests:

SpecialRecentchanges tests only this feature. I had to filter out
the rc_timestamp condition which might cause trouble if the test
suite is run on another day. A better solution remains to be implemented.
2011-03-02 20:40:40 +00:00
Alexandre Emsenhuber
60f1302644 Per Platonides, fix for r82686: make ApiUploadTest work again
Added option request parameter to User::editToken() and User::matchEditToken() and use them where possible from the api.
Also removed $_SESSION usage since it's no longer needed
2011-03-02 12:52:47 +00:00
OverlordQ
2b99df7615 Followup to r82874, restore lost edits 2011-02-28 21:57:56 +00:00
Antoine Musso
cb1b863ab1 FormOptions: adds doc & tests 2011-02-28 20:58:34 +00:00
Platonides
6a8e32d794 Blindly fix the error produced in r82880. 2011-02-28 15:16:40 +00:00
Sam Reed
c07330264d Tweak documentation
Fix constant use in UploadTest
2011-02-27 21:11:45 +00:00
Sam Reed
1cc6c09281 $somevariable; doesn't count as defining a variable 2011-02-27 00:36:10 +00:00
Platonides
51aa2c01b3 r82877 fixup. It should have only removed the = null bit. 2011-02-26 23:47:41 +00:00
Platonides
e82b7e169c Remove NewParserHelpers.php and use instead the original TestFileIterator from which it was copied in r79411.
Remove the $this->parserTest checks as r79411 did. They are no longer needed. They were here since 
TestFileIterator addition in r62006 back when this file was called parserTests.inc, before being renamed twice 
without preserving history.
The wfDie(); wasn't intended to fall into trunk. It was marking a dead branch and got committed by error in r76149.
2011-02-26 23:45:35 +00:00
Platonides
9f9487fd21 Reapply the @ingroup change which was done in r78389 at the same time it was copied.
The © corruption seem to have been done at the same time, as this doesn't need r78389 reapplied.
2011-02-26 23:44:37 +00:00
Platonides
957c9a76a2 Readding parserTests.php and testHelpers.inc with history back to r73884 when they had also been moved without telling svn about it.
Follow up to r78389 and r82873.
2011-02-26 23:36:30 +00:00
Platonides
9eca91b785 Remove testHelpers.{inc,php} for recommiting with history lost in r78389. 2011-02-26 23:31:44 +00:00
Platonides
2e33fb3ff6 Finally commit the testing stuff I have been with this week. Could be considered a continuation of r79411.
Mixture of the NewParserTests.php with old code present in MediaWikiParserTest.php, reverting r79184 (revert of a revert...) and even eval().
Using the iterator as dataProvider, but defering the insertion of articles, as the dataprovider is processed on load, before switching dbs.
Each parser test appear now as a phpunit test. This means that by adding 683 tests (partly from extensions) we now surpass two thousand tests.
The downside of that is that they become painfully slow.
Initialise $wgHooks to $wgHooks, not to array() (r82499) as otherwise we lose ParserFirstCallInit registrations.
There's no attempt to support extensions registering to $wgParser instead of using ParserFirstCallInit properly (Cite falls in this category).
2011-02-26 21:49:42 +00:00
Max Semenik
798dafa4dd Follow-up r82856: instead of remembering magic table names, just analyse its structure, added tests. 2011-02-26 16:45:35 +00:00
Bryan Tong Minh
ecf3419a3a Remove double parser test from r82843 2011-02-26 12:19:55 +00:00
Bryan Tong Minh
bf067d3395 (bug 27679) Broken embedded files with special characters are no longer double HTML escaped
Was a double escape in Linker::makeBrokenImageLinkObj. I checked the callers and other usages in the function and $prefix and $inside appear to be assumed HTML fragments
Added parser tests: Passed 622 of 624 tests (99.68%)... 2 tests failed! Those two tests already failed for me before this patch
2011-02-26 12:08:59 +00:00
Tim Starling
0a21e2de12 * (bug 24230) Added JAR detection. ZIP archives containing a .class file will be rejected by default. Malformed ZIP archives will be rejected due to the danger of ambiguous parsing on the client side.
* Removed the ZIP subtypes from $wgMimeTypeBlacklist, they no longer need to be there.
* Added ZipDirectoryReader. Added some small ZIP files which are used to test its various error cases. Most were constructed with a hex editor.
* Fixed getStatusArray() to return a consistent type regardless of whether the error message has parameters. This allows error messages with no parameters to work with the Status object conversion code in UploadBase::verifyFile().
2011-02-25 04:51:17 +00:00
OverlordQ
102e3d21a7 Fix core parserTests for recent <gallery> changes 2011-02-24 17:16:31 +00:00
Max Semenik
5875959e25 Very basic JavaScriiptDistiller tests, needs serious expansion 2011-02-23 08:06:11 +00:00
Max Semenik
f36ac21d6b Revert coloring from r79117: doesn't work on Windows 2011-02-23 07:28:15 +00:00
Platonides
49ed86e93f Remove trailing ?> 2011-02-22 15:09:41 +00:00
Platonides
4ef087080d maintenance/commandLine.inc loads DefaultSettings, LocalSettings and then runs Setup.php
As Setup.php assigns variables based on the cache config, bootstrap.php was late on reseting them, as some objects were already created.
So we could end up with a SqlBagOStuff created there, which when later accessed (such as trying to invalidate the cache for a user) would 
-as any non-sqlite SqlBagOStuff- open a new db connection. Which is precisely what we shall not be done when dealing with temporary tables
(and would indeed fail miserably due to not finding unittest_objectcache table).

In summary, reenabling temporary tables disabled in r79411.
2011-02-21 23:19:26 +00:00
Antoine Musso
e9149c09f0 remove hardcoded local path 2011-02-21 22:56:16 +00:00
Antoine Musso
f909c62d64 improve namespace related methods
MWNamespace::getTalk() could give erroneus results when using it on specials
namespaces (NS_MEDIA, NS_SPECIAL). It now use MWNamespace::isMethodValidFor()
which will throw an exception if a special namespace was given.

MWNamespace::getSubject() is now returning identity for specials namespaces.

New MWNamespace::getAssociated() used to find out the subject page of a talk
page and vice versa. Special namespaces will results in an exception.


TESTS:

Added tests for almost complete code coverage. Functions relying on global
$wgCanonicalNamespaces are still incomplete though.
MWNamespace::isMovable() needs more assertions.

Tests results (ignoring incomplete tests output):

$ php phpunit.php --filter MWNamespace
PHPUnit 3.5.10 by Sebastian Bergmann.

.........IIIII..........

Time: 1 second, Memory: 31.75Mb

OK, but incomplete or skipped tests!
Tests: 24, Assertions: 99, Incomplete: 5.
2011-02-21 22:17:06 +00:00
Platonides
74b466ae9c Spaces to tabs 2011-02-20 17:52:09 +00:00
Antoine Musso
5f7fca71cf Force wgDebugTimestamps false
Test GlobalTest::testDebugFunctionTest() does not take into account the setting
$wgDebugTimestamps = true.  Setting it false makes sure the tests pass though
not testing the settings :(
2011-02-20 17:44:37 +00:00
Platonides
1810cf1af1 Fix ArticleTablesTest after r81528. It needs to set both $wgLanguageCode and $wgContLang.
Added setUp() and teardown()
2011-02-20 00:44:33 +00:00
Platonides
32a37f873d Break the self-reference between parser and preprocessor, so they can be counting collected.
Saved a couple of Mb in the destructive make (126.25Mb -> 124.25Mb).
2011-02-20 00:27:01 +00:00
Platonides
bee16714e0 Save and restore $wgHooks in NewParserTest.
ParserGetVariableValueTs hook still being set to ParserTest::getFakeTimestamp was the reason for the crazy failures of MagicVariableTest inside phpunit that I was seeing.
2011-02-20 00:13:26 +00:00
Platonides
b856f6605b (Bug 27539) Allow attributes beginning with a digit in wiktext tag parameters.
Its removal in r70849 breaks ProofreadPage extension.
Restricted r82475 relaxation to just numbers.
Added tests.

This only affects wikitext (tag hooks).
MW_ATTRIBS_REGEX is only used through decodeTagAttributes() calls.
fixTagAttributes() calls decodeTagAttributes(), and would be nastier to 
fix, since it is called with HTML parameters (eg. by removeHTMLtags)
but such incorrect parameters grabbed would be removed by validateTagAttributes()
2011-02-19 20:16:54 +00:00
Sam Reed
4e0324de08 Fix wrong static calls 2011-02-18 01:00:05 +00:00
Brion Vibber
638b6751e1 * (bug 25571) Xml::encodeJsVar now passes floats natively instead of converting to strings
Added unit test cases for int, float, and strings that look like int or float.
2011-02-14 00:54:40 +00:00
Aaron Schulz
f65ce02ff9 * (bug 27353) IPv6 address ending in "::WORD" was not recognized
* Moved down 'contains no "::"' alternative for clarity (and possibly use frequency too)
* Added more IPv6 tests
2011-02-13 23:24:48 +00:00
Niklas Laxström
1d2a41ade7 whitespace 2011-02-12 20:09:12 +00:00
Platonides
593c746d37 Do r82017 the right way. Fix pointed by Bryan. 2011-02-12 15:18:59 +00:00
Platonides
585e1b7c61 Follow up r81883. Readd the extension. This kind of breaks the tempnam() guarantee, but otherwise with no extension the uploader returns UploadBase::FILETYPE_MISSING, not UploadBase::SUCCESS. 2011-02-12 14:58:16 +00:00