Commit graph

731 commits

Author SHA1 Message Date
Krinkle
6ebbb369a6 [Xml::encodeJsVar] Change to match FormatJson::encode output
- Pure whitespace change
- In preparation to deprecate it in favor of FormatJson / json_encode
2012-01-30 19:40:20 +00:00
Antoine Musso
3bbbe1f867 make sure we test normalization against normalized title
This patch fix ApiQueryTest::testTitlesGetNormalized() when $wgMetaNamespace
would contains space / underscore.

Example:
-8<-------------8<------------8<------------------8<----------8<------
1) ApiQueryTest::testTitlesGetNormalized
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     'from' => 'Project:articleA'
-    'to' => 'My_Project:ArticleA'
+    'to' => 'My Project:ArticleA'
 )
-8<-------------8<------------8<------------------8<----------8<------

This patch use Title class logic to forge a normalized title instead of
manually creating it by appending two strings.

Final fix to bug 33663 (comment 21):
https://bugzilla.wikimedia.org/show_bug.cgi?id=33663#c21
2012-01-30 15:54:46 +00:00
Antoine Musso
9755d2e5aa test Html::namespaceSelector() id & name attributes generation
Method was introduced by r109990.
2012-01-30 10:39:51 +00:00
Aaron Schulz
9a1452ae92 In FileBackendBase/FileBackend:
* Moved some public static functions from FileBackend to FileBackendBase as the later defines the public API.
* Made splitStoragePath() return null if the backend or container name is empty.
* Made normalizeContainerPath() kill leading directory separators.
* Added more unit tests and made some documentation tweaks.
In FSFileBackend:
* Added resolveContainerName() to disallow '.' a container name, since this would cause a traversal.
2012-01-29 21:28:31 +00:00
Aaron Schulz
638b58c272 * In NewParserTest, made it possible to use the --use-filebackend param to run the tests on a given registered backend.
* In FileBackendTest, killed useless recursiveClean() call.
2012-01-28 01:20:42 +00:00
Aaron Schulz
ece8bb5e6f r110180: fixed copy-paste cruft for custom backend code. Also made backend names consistent. 2012-01-28 00:43:55 +00:00
Aaron Schulz
e9f1ffeed7 Killed the metric arseload of test folders that were being leaked and killing jenkins 2012-01-27 22:57:14 +00:00
Aaron Schulz
6c784b1812 Fixed a bunch of dir leakage 2012-01-27 22:46:55 +00:00
Alexandre Emsenhuber
308660c29a Use WikiPage instead of Article to call doDeleteArticle() 2012-01-27 21:21:19 +00:00
Chad Horohoe
e8da212569 Fixup r109698, add setter for $namespaceNames and use proper accessors in the tests.
Since we're here: nothing uses $namespaceNames, $mNamespaceIds or $namespaceAliases
outside of this class (core or extensions) so lets make it protected.
2012-01-27 13:00:26 +00:00
Aaron Schulz
c1c6433bfc * In NewParserTest, refactored code to use FileBackend (bug 31737). Also made some speed improvements and made regex= not flood the output with 600 items of crap.
* In FileBackendTest, call clean() on the dirs *after* deleting all the files first.
* Speed improvements to MediaWikiTestCase.
2012-01-25 23:11:53 +00:00
Krinkle
3065ece7a2 Fix broken unit test
* r109993 broke the test by overwriting namespaces it tried to preserve
* tearDown should always have the opposite order of the overrides in setUp
* Adding wgLanguageCode while at it, no reason not to, just in case.

-- Follows-up r109993
2012-01-25 03:45:01 +00:00
Krinkle
3c9d05055b [Html] Unit test + bugfix Html::namespaceSelector
* Previously it was passing $selectAttribs['name'] to Xml::label, which uses its value for the <label for=""> attribute. This works as long as $selectAttribs['id'] and $selectAttribs['name'] match, but when they don't it fails. <label for=""> always corresponds with <{input,text area,select} id=""> in browsers, never with "name".
* Make name/id match eachother by default to avoid backwards compatibility breakages (they used to match in the Xml class method as well)
* Add HtmlTest.php entries similar to the ones in XmlTest
* Fix E_NOTICE about $params['selected'], default to ''

-- Follows-up r109974, r109698, r109990
-- Bug originally introduced in r41425
-- XmlTest.php still runs successfully
-- HtmlTest.php runs successfully
2012-01-25 03:25:54 +00:00
Aaron Schulz
d1b159ef63 In FileBackend:
* Use 'b' param in some fopen() calls as needed for Windows and newline handling.
* Removed some useless padding code in FileBackend::getContainerShard(). Initialized $m to make IDE happy.
* Updated some code comments.
In SwiftFileBackend:
* Manually set the ETag when using php-cloudfiles for creating files to avoid https://github.com/rackspace/php-cloudfiles/issues/59.
* Manually set the content type based on how StreamFile::getType(). This makes it safe to read files directly out of the proxy to end-users. The streamFile() backend functions already uses a similar content-type check.
2012-01-25 01:57:28 +00:00
Krinkle
957c3b5b68 [Unit testing] Re-order attribs to a-z to make testing more reliable
* This is in preparation for deprecating this in favor of an Html:: method soon, making sure here that tests still match afterwards
* Follows-up r109698
2012-01-25 00:52:29 +00:00
Aaron Schulz
73d4d6edbf Made FileOp classes enforce required params. Also reverts r109823. 2012-01-24 05:54:47 +00:00
Antoine Musso
5eba9f361a FileRepo: check constructor parameters
new FileRepo() requires an array of parameters having at least the
'name' and 'backend' key setup.

TODO: 'backend' keyword should probably default to FileBackend.
2012-01-23 14:50:54 +00:00
Aaron Schulz
a0bce8f10e * Added some wfProfileIn() calls to file backend code.
* Made FileBackend::getFileProps() final.
* Added exception needed in SwiftFileBackend::getConnection().
* Various FileBackendTests fixes and additions. Optimized it a bit by keeping the backend instance in memory.
2012-01-23 08:33:31 +00:00
Aaron Schulz
609cf8d522 * Modified StoreBatchTest and FileBackendTest to allow specifying a registered backend to use
* Improved FileBackendTest file pruning and added more getFileList() tests
2012-01-22 00:34:04 +00:00
Krinkle
4790826b97 [Unit testing] Add unit tests for Xml::namespaceSelector
* Making Language::namespaceNames explicitly public. It already was but since is being used as such outside the class
2012-01-21 22:26:14 +00:00
Aaron Schulz
eb92ac5557 * Added FileBackend::parentStoragePath() convenience function for getting parent directories.
* In StoreBatchTest: sed proper clean() function to remove temp dirs (follows up r109641). Also removed some commented out code.
* Fixed temp dir leakage in FileBackendTest.
2012-01-20 22:46:35 +00:00
Platonides
3f76d9e2b0 Fix folder leakage. 2012-01-20 20:15:26 +00:00
Platonides
fe5a57bd2e If you are going to leak folders, at least give them your surname. 2012-01-20 19:46:27 +00:00
Sam Reed
ec4604de3d Documentation and whitespace
Clearing another w/c
2012-01-19 14:56:18 +00:00
Alexandre Emsenhuber
de67af20d0 $wgLanguageCode goes with $wgContLang, not $wgLang. This was breaking ApiBlockTest because $wgContLang->getCode() != $wgLanguageCode. 2012-01-19 10:05:38 +00:00
Aaron Schulz
d0fc7d5d89 Renamed 'overwriteDest' FileBackend operation parameter to just 'overwrite', which is shorter and more consistent with 'overwriteSame' 2012-01-19 02:24:49 +00:00
Antoine Musso
3ceb767b83 MWDebugTest: clear log before running tests
Some other test could have added their own logs, for example
deprecated notice. In that case, the first test will fail because
the log array already has some content :-b
2012-01-18 15:58:25 +00:00
Antoine Musso
79c979b4e8 tests: mark tests requiring a database connection 2012-01-18 15:50:00 +00:00
Antoine Musso
19854b4e28 enable MWDebug tests
The first ones were failing because the test suite ran on gallium without
MWDebug being initialized. This is now the case since r109033.

The second part was failling because PHPUnit on gallium does not have
the assertCount() method. Use a assertEquals() / count() workaround instead.


Tests added by 108873
Reverts r108877
2012-01-16 13:56:18 +00:00
Antoine Musso
acffbd72e5 test with MWDebug enabled (made possible by r109032) 2012-01-16 13:50:17 +00:00
Antoine Musso
01b3af3ac6 Skip BrokenRedirectsPage query test under MySQL
The MySQL backend, when using temporary tables, does not support referencing
a table which was already open.
http://bugs.mysql.com/bug.php?id=10327

This patch skip BrokenRedirectsPage on MySQL as reported on r102411.
2012-01-16 10:33:24 +00:00
Aaron Schulz
c4a01a7afd In FileOp/FileBackend:
* Added SHA-1 to FileOp::attemptBatch $predicates (since concatenate was removed from FileOp). This lets us get rid of temp file backups, as the remaining failure case is just the backend medium going down (the ops would break in that case anyway). Doing so reduces RTTs and backup file I/O overhead. This also simplifies expiry object support by avoiding having to stash the expiry values of temp backup objects somewhere.
* Improved precheck() and attempt() status logic in FileOp::attemptBatch() a bit. Use separate $subStatus var to check if each op is OK.
* A few minor code cleanups and comment tweaks.
* Fixed MoveFileOp bug found in unit tests when the source/dest are the same and an overwriteDest/overwriteSame param is given (the file would just get deleted). Improved CopyFileOp in this case too.
Other:
* Added more unit tests.
2012-01-15 22:45:14 +00:00
Aaron Schulz
b51c4a3328 Removed call to ParserTest::setUp() which was unnecessary. Also, the called function leaks globals anyway atm. 2012-01-13 23:39:48 +00:00
Aaron Schulz
36c143110a In FileBackend:
* Made secure() call doPrepare() for caller dummy proofing (especially those that don't check the status).
In FSFileBackend:
* Removed redundant wfMkdirParents() calls in FSFileBackend, we already have prepare() for this purpose. This also keeps it's behavior more consistent with the other backends.
* Made use of 'backend-fail-store' message in doStoreInternal().
Other:
* Updated unit tests and renamed $src => $source in some functions for consistency.
* Added some documentation comments and @since tags.
2012-01-13 23:30:46 +00:00
Antoine Musso
d7520ca760 Disable MWDebug tests for now
PHPUnit is too old on gallium so assertCount() is not recognized
The other two tests are broken for an unknown reason.
2012-01-13 23:26:26 +00:00
Antoine Musso
0f02086990 some tests for MWDebug
Really incomplete. We need better testing.

Added two new public methods so we can get or clear the internal logs.
2012-01-13 23:07:52 +00:00
Aaron Schulz
76298accc0 * Added 'basePath' config param to FSFileBackend and tweaked it to behave more similarly to the backends with real containers (e.g. everything else). Resolution to absolute paths is now deferred after resolveStoragePath(), using resolveToFSPath().
* Fixed whitespace in FSFileIterator.
2012-01-12 18:44:00 +00:00
Antoine Musso
ee868909e9 swap assertEquals parameters in TemplateCategoriesTest
First parameter is expected, second is the result
2012-01-12 16:42:33 +00:00
Antoine Musso
ca27814f63 bug 33583 search ns user pref ignored!
r106780 to fix bug 33270 introduced a new bug that prevented selected
namespaces for search to be applied. This patch fix the issue.

Credits to Brad Jorsch
2012-01-12 09:03:38 +00:00
Max Semenik
6d87a6ea8f Revert r108603, which was itself a revert of r107376, r107994. Before considering something unneeded, please ask first ;) 2012-01-11 20:19:55 +00:00
Antoine Musso
f5f1b6d0bb Reverts MySQL stored procedure support
This is reverting the work done by MaxSem to support stored procedures
and stored function in MySQL. The reasons are:
 - it is not needed yet
 - tests are not functionals
 - alter the stable include/db/Database.php and drop support for ';;'

So please create a branch to work on it and merge it back in trunk
once we have branched 1.19 :-)

I have opened bug 33654 to track this enhancement request.

Reverts r107376, r107994.
2012-01-11 09:46:21 +00:00
Antoine Musso
44b06f908e reverts Concurrency works
trunk is frozen pending stabilisation so we can release MediaWiki 1.19.
Those changes introduces API changes and new SQL tables, so that sounds like
new feature we do not have time to review right now.

Please reapply changes in branches/concurrency and have code review handled
there. Once the branch has been reviewed, please hold. Once trunk is stable
enough and 1.19 got branched, you are welcome to merge the branch in trunk.

Note: we can have a Jenkins jobs setup to run the branch tests if you need.

Reverts:
r108595 r108591 r108585 r108584 108572 r108564 108560 r108559
2012-01-11 09:05:56 +00:00
Ian Baker
65de21c0d4 Commenting these tests out so that CI can run, since I need to leave and nobody uses this code yet.
These fail only on sqlite, and only when run with the entire suite (they're fine when run individually).
Skipping ApiBlockTest allows ApiConcurrencyTest to run, oddly enough.
Clearly, this will need to be fixed ASAP.  I'll take care of it on Thursday when I'm back online, or possibly
before.
2012-01-11 02:48:28 +00:00
Ian Baker
27ed15ba5c Fixed concurrency issues related to mysql default locking mode, per Roan's comments. Fixed other little bugs Roan pointed out also.
followup to r108559
2012-01-11 01:10:27 +00:00
Sam Reed
0284615485 Add svn:keywords Id
Trim trailing whitespace

Add explicit member variables
2012-01-10 23:12:00 +00:00
Ian Baker
b3c84ce261 MERGE branches/concurrency 108301:108557 into trunk 2012-01-10 23:03:03 +00:00
Antoine Musso
f0493a88a0 move parser fuzz test to ParserFuzz group
Somehow fixes bug 29493:
« Put parser fuzz tests in @group and disable by default »
2012-01-10 20:50:34 +00:00
Antoine Musso
0323c900f7 StoreBatchText note about using custom repo
follow up r108308
2012-01-10 14:26:17 +00:00
Platonides
4fc7769069 Revert r108358. It's a good fellow and we like to keep it. 2012-01-09 22:33:00 +00:00
Antoine Musso
2721648de3 Break wfBCP47, wfBaseName and wfTimestamp tests
They are now in their own files. Rewrite wfTimestamp tests to use
data providers like it should.

Originally commited without history by ^demon as r108420
2012-01-09 16:30:32 +00:00
Antoine Musso
13427e7448 revert r108420, will split with history 2012-01-09 16:21:13 +00:00
Chad Horohoe
3bdc1d5e99 * Drop old parserTests.php way of running parser tests. You can run parser tests via --group Parser or specifying
the includes/parser/MediaWikiParserTest.php test case
* Drop now unused various test recorder options -- phpunit outputs its data in lots of machine-readable formats, use those if you need to work with
  test data
* There's still a lot of duplication between NewParserTest::setUp() and MediaWikiTestCase, but hey one step at a time ;-)
* All tests pass for me (make phpunit && make parser)
2012-01-09 15:18:07 +00:00
Antoine Musso
2622e95bba reindent SpecialSearchTest.php (follow r198400) 2012-01-09 14:42:02 +00:00
Chad Horohoe
6cc1277748 Remove no-op codepath 2012-01-09 13:04:05 +00:00
Antoine Musso
b549176edf test skeleton for Special:Search
Only two tests for now. A third one was written for r106780 / bug 33583
but is disabled to avoid breaking Jenkins.
2012-01-09 11:41:13 +00:00
Aaron Schulz
3cd02f7a38 * r107986: Added readOnly checks to prepare(), secure(), and clean() in FileBackendBase.
* Added some prepare()/clean() tests.
2012-01-09 00:20:28 +00:00
Aaron Schulz
50a7097436 * Fixed 'success' value of doOperations() Status to match documentation.
* Made 'success', 'successCount', and 'failCount' fields reflect the overall operation in FileBackendMultiWrite::doOperationsInternal(). This makes it match up with single-write backends.
* Made FileBackend::clearCache() part of the public API.
2012-01-08 22:10:53 +00:00
Chad Horohoe
95d52efc32 * Drop old parserTests.php way of running parser tests. You can run parser tests via --group Parser or specifying
the includes/parser/MediaWikiParserTest.php test case
* Drop now unused various test recorder options -- phpunit outputs its data in lots of machine-readable formats, use those if you need to work with
  test data
* There's still a lot of duplication between NewParserTest::setUp() and MediaWikiTestCase, but hey one step at a time ;-)
* All tests pass for me (make phpunit && make parser)
2012-01-08 17:28:13 +00:00
Chad Horohoe
d455b3b267 Another @group Broken 2012-01-08 16:40:05 +00:00
Chad Horohoe
35a5be8617 @group Broken rather than marking incomplete 2012-01-08 16:38:59 +00:00
Aaron Schulz
94c3039106 * Follow-up r107170: Moved FileBackend::concatenate() outside of doOperations() as it's own separate operation. It does not mutate storage files like the others and having it in doOperations() broke FileBackendMultiWrite. This change also makes overriding doOperationsInternal() easier (suching as using a custom batch operation storage API).
* Added sanity check to FileBackendMultiWrite constructor.
* Moved FileBackend::create() function up a bit.
2012-01-08 09:25:15 +00:00
Aaron Schulz
360e3376bf In FileBackend:
* Added getFileSize()/getFileStat() functions. Refactored some functions to use the stat function for better reuse and caching/consistency.
* Refactored streamFile() to allow for subclasses to avoid local file copying with less duplication. Also make last-modified check actually work since we always get the timestamp of the original file.
* Renamed 'ignoreErrors' parameter to 'force'.
In FileBackendMultiWrite:
* Simplified how read ops are done (use 'master' backend for consistency).
* Added consistency check to doOperationsInternal() to check if the files are synced.
* Various fixes after testing.
In StreamFile:
* Split out prepareForStream() function from stream() in StreamFile for code reuse.
In FileBackendTest:
* Properly cover FileBackendMultiWrite in tests.
* Various test improvements.
2012-01-08 08:40:00 +00:00
Platonides
81bdbc0592 Calls to editToken() that r103294 missed. 2012-01-07 23:26:35 +00:00
Platonides
a26f9bd70f r102411 fixup. Close register globals vuln, and document
why is there that require_once.
2012-01-07 22:42:05 +00:00
Alexandre Emsenhuber
40c98e0ad1 * Don't select (even twice for PHPUnit tests) "FOR UPDATE", but use the master database directly instead
* Also pass the line number
* Removed useless usage of $title when throwing the exception about invalid since that variable is always null
* Added $ignoreDuplicate parameter to ParserTest::addArticle()
2012-01-07 12:19:10 +00:00
Aaron Schulz
6a1bb85f80 r108300: updated parserTest.inc tests and re-enabled testBug29408() 2012-01-07 09:26:11 +00:00
Aaron Schulz
d010652a6d Dependency inject the repo/backend for proper testing rather than relying on the wiki config 2012-01-07 06:13:01 +00:00
Aaron Schulz
73e83a48b9 * Fixed bogus dollar signs left in $tmpGlobals array keys in r108300.
* Various documentation cleanups.
2012-01-07 03:46:54 +00:00
Aaron Schulz
7d923a9360 In FileBackend/FileOp:
* Replaced 'media' portion of container names with the repo name. This makes it easy for multiple repos to use the same backend without 'wikiId' hacks. Full container names are now like <wiki>-<repo>-<zone> (or <repo>-<zone> if 'wikiId' is set to an empty string).
* Restricted isValidContainerName() more in light of Azure portability and shorted shard suffix.
* Bumped $maxCacheSize to 75 storage paths.
* Code comment cleanups and additions.
Unit tests:
* Updated related tests and marked testBug29408() as broken (I can't find the problem).
* Reduced leakage in UploadFromUrlTestSuite a bit.
2012-01-07 01:33:23 +00:00
Aaron Schulz
78f5e5a63e Fixes for r106752:
* Make sure FSFileIterator::current() directly returns the string path and that it is relative to the directory being searched.
* Fixed silly bug in testGetFileList that masked any bugs.
* Added a few code comments.
2012-01-06 05:15:51 +00:00
Brian Wolff
f9173cb902 Make sure that if we fail to read the App13 (iptc) block of a JPG file, that that doesn't block other metadata from being read. Also makes sure if more then one app13 block is in the file, they are all read, not just the last one that appears in the file (This required some changes to tests since before the intermediate value was just one value, now its an array of all such blocks) 2012-01-05 23:25:39 +00:00
Daniel Friesen
14a99505df Followup r105809; Split up the tests with a dataProvider and add a round trip test. 2012-01-05 00:26:13 +00:00
Max Semenik
2034614e92 Follow-up r107376: disable test by default, causes failures in some configurations 2012-01-04 08:38:13 +00:00
Aaron Schulz
03ed413c93 * Added FileBackendBase::getFileContents() function with a default FileBackend version.
* Added read-only mode to FileBackendBase config.
* Moved FileBackendBase::getFileTimestamp() up slightly.
2012-01-04 02:15:07 +00:00
Brion Vibber
037bb74827 PHPUnit test case for bug 31719 (followup r107793) 2012-01-03 21:12:24 +00:00
Krinkle
be12ebf1ab [Core JS] More fixing of global config variable usage
* mw.config is the new way, and global config variable lookups are deprecated

* Based on two phase3-wide quick searches:
-- of " wg": http://toolserver.org/~krinkle/wikimedia-svn-search/view.php?id=321&hash=81700bf7486e4fee3b7bc1f83eb9eba6
-- of "!wg": http://toolserver.org/~krinkle/wikimedia-svn-search/view.php?id=327&hash=47c9d54a7a1d5d58a724dd834585f40d

Related changes:
* Changed some php comments mentioning "wg" variables to include the dollar sign, and a typo when the wf function prefix was meant.
* Removed TODO comment in wikibits.js and made it use the JS equivalent of wfUrlencode, which we have now, mw.util.wikiUrlencode 
* SpecialUpload.php: use OutputPage::addJsConfigVars instead of creating a new script tag through OutputPage::addScript(Skin::makeVariablesScript(..))
* Renamed wgUploadSetup in upload.js and made it local. Not used anywhere in ./trunk/phase3 and ./trunk/extensions
* Fix OutputPage::addJsConfigVars so that it can actually be called with an array instead of two arguments for key/value
* Some minor whitespace/convention stuff around the same line
2011-12-31 21:25:00 +00:00
Platonides
31b34304a1 Need to set mDataLoaded so that this works without a db 2011-12-27 20:48:06 +00:00
Max Semenik
6b7317c91f Added support for stored procedures/functions to MySQL:
* Refactored DatabaseBase::sourceStream(), made it possible for descendant classes to alter its behaviour w/o having to redo it completely like Oracle does.
* MySQL class now supports specifying DELIMITER.
* Thrown away the mess of catering for double semicolon. If it's a problem, fix your .sql files!
* Haven't actually touched Oracle.
* Tests!
2011-12-27 12:29:36 +00:00
Jan Gerber
63030e19b5 Add phpunit tests for chunk upload api.
Follow up r104687
2011-12-27 05:06:41 +00:00
Aaron Schulz
875f8a28e9 In FileBackendBase/FileBackend:
* Changed concatenate to store to a specified temp FS file rather than a final storage destination. This makes it better fit the use case (chunked upload), so we can avoid extra copying around. Subclasses no longer have to implement this function now as well.
* Added extensionFromPath() helper function.
* Moved createInternal() up a bit and fixed @see comments pointing to the wrong functions.
In FSFileBackend:
* Use parent implementation of doConcatenateInternal().
In FileRepo/File:
* Added FileRepo::ALLOW_STALE and made thumbnail transforms use it.
2011-12-23 18:59:39 +00:00
Brion Vibber
2fc16ba670 Add comments explaining that the funky multiple Location headers stuff is a CURL artifact, and that the code will need updating if bug 29232 is done (high-level handling of http redirects)
Followup r94881, r106948.
2011-12-22 23:12:44 +00:00
Max Semenik
713ffa90f2 Moved SQLite test .sql files to the common test data directory 2011-12-22 09:18:39 +00:00
Aaron Schulz
eeb4bd77e1 * FU r106752: de-uglified Setup.php by moving most of the b/c code into FileBackendGroup. Deferred registration of file backends and lock managers to the respective singleton() functions for the group objects.
* Refactored FileRepo::initZones() to require the specific zones; nothing was using it differently.
* Removed deleted zone check in deleteBatch(), a similar error will instead trigger with the initZones() call as needed.
* Added $wgLocalFileRepo comment.
* Updated tests.
2011-12-22 01:06:19 +00:00
Ian Baker
97a6495487 This isn't a doc comment, so shouldn't start with /** (and it messes up my syntax highlighting) 2011-12-21 22:48:00 +00:00
Ian Baker
77320e1994 changed instances of sample.com to example.com per RFC 2606 2011-12-21 22:22:01 +00:00
Alexandre Emsenhuber
705c7d3951 Use LinkCache::singleton()->clear() instead of using a local variable so that I can see what LinkCache::singleton() will be used for directly in grep 2011-12-21 18:46:39 +00:00
Antoine Musso
7505ddbb6d tests for r94881 which interprets relative Location: headers 2011-12-21 15:31:30 +00:00
Aaron Schulz
6efbf4d4fd Fixed typo in testGetFileList() and used the proper FileBackend function delete 2011-12-21 08:46:10 +00:00
Aaron Schulz
53f96171cc FU r106752: use "media-" instead of "images-" in container names. Long live books, video, 3D meshes, and animated holograms from the future! 2011-12-20 23:47:53 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
Platonides
dc48a07d25 ExtraParserTest::testTrackingCategory and ExtraParserTest::testTrackingCategorySpecial need a db 2011-12-19 21:00:03 +00:00
Russ Nelson
7f16501760 clean up temp files. Fixes r99546 only better this time. 2011-12-16 20:01:08 +00:00
Russ Nelson
9e74cdbd21 clean up temp files. Fixes r99546 2011-12-16 19:59:58 +00:00
Sam Reed
01f410911b Seriously, don't use "wgOut" as a function parameter name 2011-12-13 15:47:04 +00:00
Antoine Musso
0ec2d313f0 fix typo in message
follow r105891
2011-12-12 15:47:31 +00:00
Antoine Musso
08b90ed58b use an helper to test NS subjects 2011-12-12 15:39:01 +00:00
Antoine Musso
fd23fb72d8 add some namespaces equality tests
Follow up 103893
2011-12-12 15:31:48 +00:00
Antoine Musso
78e9bbd529 use MWNamespaceTest helpers based on __call()
* Added some new methos such as Watchable/Subpages/Capitalized/Content
* Fixed namespace 0 being converted to NS_ , now show NS_MAIN
* Converted all assertion calls to use the __call() hack

Follow up r105883
2011-12-12 15:26:12 +00:00
Antoine Musso
90a5c227dc use __call() to instantly have some new fresh helpers
Only for MWNamespaceTest :-)
2011-12-12 15:02:47 +00:00
Antoine Musso
7b66f6d486 Better output message for ApiPurgeTests
Follow up r10833
2011-12-12 10:25:29 +00:00
Tim Starling
3da36a9103 Reverted r92364 (per-namespace permissions).
This is the wrong configuration format for such a feature, and the wrong interface. We already have certain per-namespace permissions in the Title class, and we didn't need to add extra formal parameters to a whole lot of User methods in order to get them. The feature should be implemented wholly in Title, and the concept of user rights should remain relatively simple and easy to understand, and independent of its many applications, i.e. a user either has a right or doesn't. Rights are just a tool for developing access policies; the complexity should be in the caller.

The revert was mostly done by hand, since there were a lot of conflicts. I tried to preserve the gist of conflicting changes in r102187 and r102873. The test changes are not simple reverts, rather I just edited out the per-namespace tests. I reverted the followups r92589 and r104310.
2011-12-12 06:03:01 +00:00
Sam Reed
7a0353b010 Mark the test as broken again seeing as Jenkins isn't happy 2011-12-12 00:07:22 +00:00
Sam Reed
24d9a9f179 Revert r105834, WMF locally after fixing PHPUnit 2011-12-11 23:29:06 +00:00
Sam Reed
49d471c67a Mark testPurgeMainPage broken after r105828 and r105833
PhpUnit is more than broken locally (and phpunit.de is down)
2011-12-11 22:39:48 +00:00
Sam Reed
82ee95eb92 Attempt to fix tests broken by r105828
Test wanted in a specific order, now just look up wanted array key from title row

Untested as my phpunit tests seem to be b0rked locally :(
2011-12-11 21:49:05 +00:00
Daniel Friesen
57c8fe18c7 Update wfArrayToCGI and wfCgiToArray:
- 'foo' => '' now outputs "&foo=" instead of the key being omitted
- 'foo' => null and 'foo' => false now omit the key instead of outputting "&foo="
- Added a test to make sure that 'foo' => true outputs "&foo=1"
- Fixed a php notice caused when passing a =value-less bit like "&qwerty" to wfCgiToArray by treating it like php and extracting it as 'qwerty' => ''
- Updated tests
2011-12-11 18:25:23 +00:00
Max Semenik
e159355c7f Added 1.18 schema to tests, comment 2011-12-11 16:56:37 +00:00
Alexandre Emsenhuber
399b120152 Follow-up r105790: make tests work again 2011-12-11 13:29:21 +00:00
Aaron Schulz
3e26c05e80 * Fixed failing FlaggedRevs tests (one due global to leaks from a core test) and made it clean up the DB table afterwards 2011-12-10 20:08:58 +00:00
Daniel Friesen
8ddf933100 Followup r104676, r104688:
- Update our woefully out of date doc comment for WebRequest::getPathInfo (we haven't simply been extracting a PATH_INFO for ages)
- Make PathRouter::makeWeight protected
- Add more comments to the PathRouter code
- Add two more edge case tests to the PathRouter tests.
2011-12-09 00:28:34 +00:00
Antoine Musso
67aebdd165 clean some files when testing upload
This catch temporary uploaded files which are six characters long.

Follow-up r102458
2011-12-08 14:03:04 +00:00
Antoine Musso
a5639ebd58 clean up whitespace / reindent 2011-12-08 13:02:34 +00:00
Brion Vibber
0f78700c55 For bug 32617: lift some code out to a function - EditPage::extractSectionTitle - so it can be tested and fixed.
Added test cases, including one that fails thus demonstrating bug 32617.
2011-12-06 23:35:42 +00:00
Chad Horohoe
a1f5c6ce73 Minor tweaks to cleanSig(inSig)
* Make cleanSig public, since it's a declared entry point per class docs
* Make cleanSigInSig public static, added 2 more test cases for it
2011-12-06 23:07:13 +00:00
Sam Reed
73f3004002 Don't comment tests out, use $this->markTestIncomplete()
Followup r104812
2011-12-01 14:40:11 +00:00
Sam Reed
6c289b9fba Comment out brokwn Xml::dateMenu() tests
Failing because it's december (ie the test is wrong)
2011-12-01 00:40:56 +00:00
Daniel Friesen
d6cf8c57b4 Followup r104274, r104676. Fix the bug that broke fr. Forgot to rawurldecode path contents.
Also add /u just for sanity sake.
Add new tests for url encoding, unicode, and length edge cases.
2011-11-30 15:09:08 +00:00
Daniel Friesen
8f8d8e4dfc Recommit PathRouter code from r104274, r104284, r104285 without the WebRequest.php and hooks.txt code so we can start to add tests and fix the bug in it. 2011-11-30 13:37:22 +00:00
Brion Vibber
f79d1d3ffb * (bug 32712) Fix for search indexing of pages with certain unicode chars following URL
A regex in SearchUpdate was built for ancient pure ISO 8859-1 and looked for \xa0-\xff bytes -- this caused the regex to cut off partway through if there was a char containing a byte in the \x80-\x9f range.
Fixed regex to pass \x80-\xff instead.

Added a test case to SearchUpdateTest which checks for this case (example text run through the update squash algo, then run through preg_replace with a /u param to make sure it gets treated as UTF-8 and checking whether it breaks.)
2011-11-30 00:36:34 +00:00
Brion Vibber
73b6bd244a Revert r104274, r104284, r104285 -- breaks special pages on non-english 2011-11-28 19:55:49 +00:00
Platonides
eb43fae8d3 Test to ensure that after adding a category to a template, the articles get moved into that category.
Articles containing [[es:Plantilla:Ficha_de_película]] showed the categories at the bottom, but were 
not in categorylinks (solved by a doing a null edit to the template and waiting for the job queue, but
how did that situation happen to begin with?).
2011-11-27 16:12:20 +00:00
Daniel Friesen
63e93db2d8 Implement path routing code.
- Makes extending paths with extensions simpler.
- Should fix bug 32621 by parsing paths based on pattern weight rather than pattern order.
2011-11-26 16:29:25 +00:00
Sam Reed
5bd492d51c "else if" to "elseif" 2011-11-25 00:15:27 +00:00
Max Semenik
a1ec828b46 Follow-up r104051: fix tests 2011-11-23 17:27:08 +00:00
Brion Vibber
e97346ec18 Revert r103978, r103979 -- screwed something up, breaks jQuery minification.
Incremented ResourceLoader::filterCacheVersion rather than decrementing to avoid potential confusion, especially since we already needed the incr.
2011-11-23 00:22:46 +00:00
Brion Vibber
6b06770b6d Followup r103865 and r103915
r103915 added a parse error for 'more than 2 decimal points' in a number; this is the wrong place to check for that. Should only check whether there's more digits or identifier chars -- identifier chars would be illegal.

Added test cases for the exponent missing fails, tweaked it to be more consistent (only need to check for one e; if we have more we can lump them in with 'not digits' :)


Also cleaned up no-longer-needed suppress/restore warnings around JS parser invocation
2011-11-22 23:10:22 +00:00
Platonides
a82a7940f6 Final fixup to r103910 and follow-ups.
Reverts r103931 test change.
2011-11-22 18:56:55 +00:00
Platonides
6cac97e88c Two decimal points may be valid, as 5..toString() == (5.).toString()
Added some tests
2011-11-22 18:42:21 +00:00
Platonides
b23dc2f758 Follow-up r103915: We need to increment $end before the strcspn.
Adjusting the tests, since it is now adding the newline after the number.
2011-11-22 18:10:25 +00:00
Daniel Friesen
3414e91bae Implement a number of namespace related equals functions:
* MWNamespace::equals to test equivalence of two namespaces (forward compatible with any changes we may make like introducing namespace keys like 'USER')
* MWNamespace::subjectEquals to test equivalence of the subject of two namespaces e.g.: MWNamespace::subjectEquals( NS_USER, $ns ); instead of testing for equivalence to both NS_USER and NS_USER_TALK
* Title::inNamespace to use instead of $title->getNamespace() == NS_???
* Title::inNamespaces for use like $title->inNamespaces( NS_USER, NS_PROJECT ) when you only care if it's in one of a number of namespaces (also accepts an array)
* Title::hasSubjectNamespace for use instead of testing for equivalence to both the subject and talk such as NS_USER and NS_USER_TALK.

Include phpunit tests for all this new code, and also add some tests for some existing code.
2011-11-22 13:34:55 +00:00
Brion Vibber
8bf802734c Add PHPUnit tests for the minification failure case in bug 32548.
This will trigger 2 test failures, where an exponent in a JS numeric literal gets split over line breaks at the '-' or '+', causing a parse error in the resulting output.
A number with the same string length but without using + or - in the exponent passes through fine, indicating that it's the -/+ that's getting misinterpreted.
2011-11-21 22:20:06 +00:00
John Du Hart
216d661d3b Bug 29524 - Rename RequestContext::getLang to getLanguage
I'll be amazed if this doens't break any tests.
2011-11-21 16:13:21 +00:00
gicode
101e3cfa2d Add wfAssembleUrl and unit tests. This is the next step towards fixing
bug 32168.  This function is the inverse of wfParseUrl and is useful when you
need to modify part of a URL and have to put it back together.

Further, with the addition of this function, there is sufficient code in core
to create a proper URI class.
2011-11-15 17:38:20 +00:00
Roan Kattouw
d045b999ec (bug 29854) Store protocol-relative links twice in the externallinks table, one with http: in el_index and once with https: . Modified patch by Brad Jorsch 2011-11-14 09:13:58 +00:00
Chad Horohoe
d04fac7853 Comment tweak on MediaWikiParserTest and make ResourceLoaderTest extend MediaWikiTestCase 2011-11-12 21:32:39 +00:00
Brian Wolff
7f5ea8a0aa Follow-up r102751 - I think this test was intermitently failing because it was re-using thumbs generated for previous tests. Add a random number to stop that. 2011-11-11 15:33:37 +00:00
Brian Wolff
0556cacac0 (follow-up r99910) Make $wgEnableAutoRotation work...
Also unit-tests. There's a bit of duplication in the unit tests, and I wasn't sure if there was a better way with less duplication.
2011-11-11 04:09:05 +00:00
gicode
fc9b3e1d92 Follow-up r102587. Add details to comments and add a couple more tests. 2011-11-10 18:02:38 +00:00
Chad Horohoe
41077bffdc Minor tweaks to r102595: remove echo that clutters output, etc 2011-11-10 15:20:01 +00:00
Alexandre Emsenhuber
6efba66c04 Made setupGlobals() return the created context and use it instead of either global variables or recreating more instance of those classes 2011-11-10 12:49:10 +00:00
Jure Kajzer
69e66bdfe9 * reverted changes to Block and ApiBlockTest made in r102625 ... PEBKAC 2011-11-10 09:36:18 +00:00
Jure Kajzer
be3bbfc539 * Added getInfinity to DatabaseOracle
* Block - replaced 'infinity' strings with DB->getInfinity calls
* UploadStash - added sequence value generation for ID
2011-11-10 07:41:12 +00:00
gicode
08de237f76 Move tests that have likely never been executed. Now they will be executed.
It might be a good idea to have a commit hook or similar to catch these.

You can find candidates for renaming with this command:
$ find tests/phpunit/includes/ -name '*.php' | grep -Ev 'Test.php$' | xargs grep -l MediaWikiTestCase
2011-11-09 23:11:52 +00:00
gicode
179f3fdf02 Add wfRemoveDotSegments and unit tests. This is a sane step towards fixing
bug 32168.  This implements RFC3986 Section 5.2.4.
http://tools.ietf.org/html/rfc3986#section-5.2.4

This is important because you need to remove dot segments in order to safely
compare URLs when limiting URLs to a particular path.
2011-11-09 22:44:12 +00:00
Platonides
a469cf2c95 Mark as FIXME. This three calls leak a png filename in sys_get_temp_dir() each,
tempnam() like, not the two-words filenames of RandomImageGenerator::getRandomFilenames()
They aren't produced by ApiTestCaseUpload::fakeUploadFile() either.
2011-11-08 22:27:25 +00:00
Antoine Musso
2368c97889 test SQL for our QueryPages objects
Part of bug 32118: test special pages SQL queries against all supported DB

Still need to add all the other non QueryPage special pages and then setup
jenkins to support other databases.
2011-11-08 16:22:42 +00:00
Alexandre Emsenhuber
d1d5d0ee89 Removed useless second parameter to Title::quickUserCan() 2011-11-07 13:54:03 +00:00
Max Semenik
18331f2a45 Windows compat for a couple of tests :( 2011-11-04 20:46:04 +00:00
Bryan Tong Minh
eac3d58b44 Per comments on r99911 move $wgMaxImageArea check back to normaliseParams(). Added hook BitmapHandlerCheckImageArea to override the area check. I'm not very happy with this overly specific hook, but I don't see a clear way to obtain the functionallity required otherwise.
Remove the width and height params from BitmapHandler::getImageArea(). There is really no reason for them to be there.
2011-11-02 20:48:50 +00:00
Platonides
a2db41381e Another old, uncommitted, test (passing on NtPP) 2011-10-31 22:24:26 +00:00