Commit graph

731 commits

Author SHA1 Message Date
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
Platonides
2903c6b9a9 Template as parameter name.
I had this test pending longtime, as it is failing in NativePreprocessor.
2011-10-31 22:21:46 +00:00
Max Semenik
7abd9f4abd Simplify r101365, this cruft is not really needed 2011-10-31 17:00:29 +00:00
Max Semenik
7e917c79b3 Fixed annoying intermittent BlockTest failures. No surprise we had 'em since blocks set to expire RIGHT NOW tend to expire at that very time:) 2011-10-31 16:54:42 +00:00
Platonides
e0afa3b22c The test "{{Foo|1=bar|2=baz}}" got removed in r96887.
Readding without the linestart="1", which is all the difference removed on this file in r96887.
2011-10-29 21:19:08 +00:00
Sam Reed
9d41b95053 Kill various unused variables
Comment some out also

Add some bits of documentation
2011-10-29 01:17:26 +00:00
Platonides
796ef5eff2 An alternative to using DOMDocument for normalizing when using Preprocessor_Hash.
Follow-up r99909.
2011-10-28 15:13:27 +00:00
Platonides
6ee7039b29 Follow-up r99909. If there is a preprocessToXml method, use that.
Some preprocessor could have preprocessToObj as a native type.

PHP Fatal error:  Call to a member function __toString() on a non-object in phase3/tests/phpunit/includes/parser/PreprocessorTest.php on line 119
2011-10-28 15:02:10 +00:00
Alexandre Emsenhuber
1d903f20e6 Pass the (correct) session doApiRequest() 2011-10-28 12:18:43 +00:00
Platonides
58c4ae9c79 Convert the string to single quoted and manually escape it.
http://us.php.net/manual/en/language.types.string.php

addslashes() is convenient, but this way we have no legitimate 
usage, and it's easier to have it banned everywhere.
2011-10-27 21:18:01 +00:00
John Du Hart
b0a7defa7f Followup r100905, disabling testGetRollbackToken because it reports as failed on Jenkins but no one can reproduce it. 2011-10-27 21:01:28 +00:00
Aaron Schulz
a727d79f97 FU r100915: split out GlobalWithDBTest (tests which need the DB) 2011-10-27 20:54:27 +00:00
Alexandre Emsenhuber
681523d5ad Fix for r100905:
* Make tests work again
* Added ApiTestCase::doApiRequest() and related to pass it to the context and removed override of $wgUser where possible
* Fix ApiLogin to get the correct User object (i.e. the logged in one)
* Fix ApiBase to feed a RequestContext to setContext() so that ApiLogin can call setUser()
2011-10-27 18:46:40 +00:00
Platonides
7d626b347b Use canonical case 2011-10-27 15:54:49 +00:00
Antoine Musso
7f2e429c17 we must have a session when testing Api upload.
For some reason, the ApiUploadTest::testLogin method no more returns a valid
session. Since most, if not all, of the ApiUploadTest tests depends on it
we want that testLogin method to fail so we can skip the rest of the tests.

Test command:
  ./phpunit.php --filter ApiUpload --tap

BEFORE:
=======

TAP version 13
array(0) {
}
ok 1 - ApiUploadTest::testLogin
ok 2 - ApiUploadTest::testUploadRequiresToken
not ok 3 - Error: ApiUploadTest::testUploadMissingParams
not ok 4 - Error: ApiUploadTest::testUpload
^C

AFTER:
======

TAP version 13
not ok 1 - Failure: ApiUploadTest::testLogin
  ---
  message: 'API Login must return a session'
  severity: fail
  ...
ok 1 - # SKIP This test depends on "ApiUploadTest::testLogin" to pass.
ok 1 - # SKIP This test depends on "ApiUploadTest::testLogin" to pass.
^C ... more skips
2011-10-27 10:28:25 +00:00
John Du Hart
998e7c3a86 Followup r100905, fixed the ApiTests 2011-10-27 01:06:50 +00:00
Aaron Schulz
e8dfaccd3b * Allow passing in a blacklist into wfIsBadImage()
* Added wfIsBadImage() unit tests
2011-10-27 00:23:23 +00:00
Sam Reed
4622da783c More documentation! 2011-10-26 04:15:09 +00:00
Sam Reed
6906724935 Add, update, tweak documentation
Fix document comment blocks

Tweak some returns
2011-10-26 03:45:13 +00:00
Antoine Musso
9a2dc2d05a Tests for r96188 features
That revision let us pass an array of values to 'class', 'rel'
and 'accesskey'. The revision requested some tests :)
2011-10-24 17:45:45 +00:00
Antoine Musso
874ae7a731 test that preloaded text is unstripped
bug 27467 reported our preloaded system did not unstrip <nowiki>
or <pre> enclosed text. The fix was applied by r82473.
2011-10-24 10:51:46 +00:00
Antoine Musso
ae87825ed9 test {{SERVERNAME}} with relative URLS
bug 31176 mentionned an issue with {{SERVERNAME}} returning the full
URL instead of servername when using relative URLs (//localhost).
The fix was made by r98193.

This patch test three different URL protocols (http, https & relative)
and check we return the expected 'localhost'.
2011-10-24 09:32:33 +00:00
Antoine Musso
c1f23144e1 using real identity for hashar
Converting my pseudonym to use my real identity instead:
Ashar Voultoiz -> Antoine Musso
2011-10-24 09:08:13 +00:00
Antoine Musso
1b39c964ab Test handling of escaped CSS comments
r85856 fixed a CSS injection issue but lacked testing. This
test verify we properly strip out CSS comments even when the
token delimiter '/*' is backslash-escaped : \2f\2a
2011-10-24 08:39:58 +00:00
Brian Wolff
19d0d43aa5 (follow-up r100575 / r99477) unit-tests for jpegMetadataExtractor dealing with padding bytes. 2011-10-24 02:47:22 +00:00
Chad Horohoe
a5979c1fc9 Forgot lowercase again, arrggghhhh 2011-10-16 22:25:41 +00:00
Chad Horohoe
2b49a3bcba Do a test for 1K 2011-10-16 22:25:18 +00:00
Chad Horohoe
7649324807 Add another test case for shorthand to integer (lowercase too) 2011-10-16 22:24:30 +00:00
Chad Horohoe
7120f21cd6 Add another test case for shorthand to integer 2011-10-16 22:24:13 +00:00
Russ Nelson
95971a5351 StoreBatchTest counts now correct, and using assertEquals 2011-10-16 22:18:18 +00:00
Chad Horohoe
d8dc3fdb11 Initial tests for wfShorthandToInteger(). Definitely needs more 2011-10-16 18:35:32 +00:00
Sam Reed
9ceb44a598 Fixup some assignments in conditionals
Add/normalise some more return statements
2011-10-16 03:27:12 +00:00
Bryan Tong Minh
cdf224eac1 Follow-up r99911: fix tests
Add NullRepo to autoloader
2011-10-15 21:38:53 +00:00
Brion Vibber
61bb13a24a Followup r80375: let PreprocessorTest work on Preprocessor_Hash etc as well as Preprocessor_Dom
Using same technique as ApiExpandTemplates to serialize the object tree back to XML, rather than asking for the DOM implementation's internal XML return function.
Have to also perform normalization on the test cases, as they aren't normalized to what libxml2 serializes. :P

Note that there are 4 test failures currently with Preprocessor_Hash, as it makes a separate <equals> element around = which doesn't appear to be in Preprocessor_Dom's output.
2011-10-15 20:21:52 +00:00
Sam Reed
27665d27ae Update some deprecated code
Documentation

Fix "/*" comments to "/**"

Flesh out some missing returns, change some return types
2011-10-14 21:18:38 +00:00
Russ Nelson
b3881a28c1 Some docs and a test for FileRepo::storeBatch() 2011-10-11 19:49:29 +00:00
Sam Reed
90e74042b4 Fix comment blocks that start /* to /** 2011-10-11 18:30:50 +00:00
Santhosh Thottingal
462319d089 Use dataProvider for the testIsValidUserName method. Followup r99466 2011-10-11 10:25:58 +00:00
Santhosh Thottingal
08aac7bd40 Stylize.php changes 2011-10-11 10:02:50 +00:00
Santhosh Thottingal
2a7c8be024 Testcases for isValidUserName method of User.php.
There are many cases this method will fail for non-latin languages, 
but not added now since there are bugs reported on that already and results
a rewrite of the method as per UAX 31 standard.
2011-10-11 09:17:36 +00:00
Brian Wolff
75c1a9f14b follow-up r99316 - Fix class name in unit test class. 2011-10-08 19:00:24 +00:00
Brian Wolff
aa61882f3e Make partial dates in XMP not have the ommitted fields fulled out to 1's (reported by AVRS on irc).
Basically, in XMP you can specify partial date (for example 2011-04 for april 2011 with no day).
We were extracting that, and fulling out the day to 01 if it wasn't present (My original resoning when writing
the code was that the nice localized date functions need a full date, but that's a pretty poor rationale for displaying
wrong date). This changes it to just display such year-month things as YYYY:MM.
2011-10-08 18:40:00 +00:00
Niklas Laxström
48714a4968 Followup r99305 - change tests to match behaviour. Would set globals but restoring them manually is just too laborious 2011-10-08 11:58:01 +00:00
Bryan Tong Minh
9dcc64bbac Follow-up r99224, fix unit tests. 2011-10-07 18:32:08 +00:00
Platonides
01a758111a Title::isValidMoveOperation needs a db 2011-10-02 21:07:17 +00:00
Max Semenik
3a20036ca4 Revert r98355 and r98357; drop the field instead. 2011-10-02 06:10:55 +00:00
Aaron Schulz
c47386e27e Tweak r98602: keep the other IP normalization for non-ranges, such as upper case for v6. This keeps it a bit more consistent. 2011-10-01 05:11:21 +00:00
Aaron Schulz
9ac53dcc3b Made provideIPCIDRs() not add a '/' if there is no prefix length. Fixes bug 31234. 2011-10-01 04:54:44 +00:00
Bryan Tong Minh
e0a6ac24e3 Use data providers 2011-09-29 19:08:08 +00:00
Bryan Tong Minh
c48b61c01b (bug 30202) Restrict file names on upload to 240 bytes, because wfTimestamp( TS_MW ) . '!' . $fileName should fit in oi_archive_name, which is 255 bytes, and also the maximum file name length on many file systems is 255 bytes.
Commit to fix UploadTest to use @dataProvider will follow
2011-09-29 19:00:45 +00:00
Bryan Tong Minh
ae6ee23e33 (bug 31213) Exception thrown when trying to move file cross-namespace.
* Don't try to construct a File object when the namespace is wrong
* Start on some tests
2011-09-29 18:35:34 +00:00
Sam Reed
af564389ad Followup r98339, r98355
Let's pretend the column never existed
2011-09-28 19:38:34 +00:00
Sam Reed
52bb2e5a28 Followup r98339
Don't try and remove the user_options column in SQLite

Added 'user.user_options' to ignores
2011-09-28 19:28:19 +00:00
Brion Vibber
72ba305da4 * (bug 31187) Fix for user JavaScript validation to allow identifiers with valid Unicode letter characters
Followup r91591, r93020: patch to jsminplus to support Unicode chars and char escapes in identifiers

Fast-path check keeps runtime about the same on most scripts (eg jquery.js parsing was abround 4100ms both before and after on my test machine)
Slow-path code kicks in if plain ASCII word chars don't extend all the way to the next whitespace or punctuation char.
Using PCRE's Unicode properties magic to ensure that we're catching everything, following ECMA-262 edition 5.1 spec.

Note that identifiers using escapes don't get normalized to their UTF-8 form; this might be a nice thing to do as it saves a couple bytes, but currently there's no change made to output.


Added QUnit tests to verify that unicode letter & escapes work in identifiers in all supported browsers (ok back to IE 6, yay)
2011-09-27 22:51:36 +00:00
Daniel Friesen
7a1d3bf06a Followup r98056; Add to this screwed up NewParserTest phpunit stuff as well. 2011-09-26 02:04:17 +00:00
Daniel Friesen
453528cc4b Followup r94465 and r94465; Add phpunit tests for Sanitizer::fixDeprecatedAttributes and fix bugs related to clear="all" and mixed/uppercase attributes and values. 2011-09-25 04:08:23 +00:00
Daniel Friesen
2a912b8c39 Followup r96717; Fix whitespace. 2011-09-25 02:09:42 +00:00
Brion Vibber
a6fa806eae Followup r97954: fix unit tests for wfShellMaintenanceCmd() to work on Unix as well as Windows 2011-09-23 22:17:41 +00:00
Aaron Schulz
122a14140a Added wfShellMaintenanceCmd() for Het Deploy support 2011-09-23 20:42:22 +00:00
Brion Vibber
94e140fc68 * (bug 31100) Fix regression in sidebar (special: page links lost parameters)
Regression in Title::fixSpecialName() in r86255; fixed and added a unit test case to TitleTest.
2011-09-22 21:35:24 +00:00
Brion Vibber
cad88cae9a * (bug 6672, 31024) Fixes for handling of images with an EXIF orientation
- sets an image's reported width/height to the logical form (portait image reports itself as portait)
- everything works in logical coordinates when sizing -- we don't touch the physical pre-rotation dimensions again until it's actual low-level resize time. This fixes several problems with incorrect thumb sizing (eg getting a 600x800 image when we asked for something that fits in 800x600 box)
- fixes unit test cases in ExifRotationTest that were reporting that the width/height were coming back with the physical form which we don't want
- removes some test cases on ExifRotationTest that tested dimension swapping in a place where we don't want it
- ensures that only logical width/height need be exposed to API etc, making exif-rotated images work via ForeignAPIRepo

Note that this may actually cause file metadata to get loaded twice during File::getPropsFromPath, as the $image parameter it passes in to the handler's getImageSize function is bogus and can't be used to fetch an already-loaded metadata blob. This should not generally be too expensive though; it's not a fast path.

Rotated files that were uploaded under previous versions may still have their width/height reversed; an action=purge on the file page will refresh it and cause thumbs to be regenerated.

Follows up on r79845, r90016, r92246, r92279, r96687, r97651, r97656, r97659.

Needs merge to 1.18.
2011-09-20 22:13:34 +00:00
Brion Vibber
7b83fa49ab Further tweaks to r96687, r90016, r97398, r97656 etc tests: try several thumbnail resolutions so we test both width-only and width & height requests 2011-09-20 20:04:26 +00:00
Brion Vibber
3f301cefee Further tweaks to r96687, r90016, r97398 etc tests: actually produce a thumbnail and check its size as well. Confirms that we're handling bounding boxes incorrectly. 2011-09-20 19:39:17 +00:00
Brion Vibber
7e80ef1467 Partial revert of broken test changes from r92246 -- for some reason it was trying to test some random handler parameter normalization instead of the actual reported width/height! Confirms that returned width/height are incorrect for exif-rotated images. 2011-09-20 19:13:52 +00:00
Platonides
824640c350 Restore ExifBitmapTest::tearDown removed in r97398 2011-09-18 20:36:35 +00:00
Brian Wolff
4fc3cd0b22 Make the phpunit old-style parserTest converter thingy not fall on its face if an extension registers a parserTests test file that has a period in it. 2011-09-18 03:32:43 +00:00
Brian Wolff
ffed20a5da Follow-up r92635 Make sure the Exif related tests handle not having the Exif extension available properly
This should fix issues reported in http://lists.wikimedia.org/pipermail/wikitech-l/2011-September/055212.html Lots of these tests loaded the exif extension dynamically, but then didn't reset $wgShowEXIF var properly.

Also change some of the markTestIncomplete to markTestSkipped as that seemed more correct.
2011-09-18 01:53:09 +00:00
Platonides
ac4b0129cb buildMainQueryConds() (called by assertConditions) uses a wfGetDB( DB_SLAVE )
Although no data is transmitted to/from the server (create a DB_NONE?)
2011-09-15 20:43:40 +00:00
Sam Reed
fb32210aee Whitespace/documentation 2011-09-14 15:07:20 +00:00
Chad Horohoe
4998acf894 Partial revert r97035, followup r96930: make recentchanges tests pass again 2011-09-14 03:31:53 +00:00
Krinkle
5bd2898ab1 Renaming SpecialRecentchangesTest file to match conventions
* There should be no two files with the same name
* Test suite files should be named after the main file containing the code being tested followed by "Test"
2011-09-14 01:37:13 +00:00
Chad Horohoe
30926a2c3c Revert r87992 and followups r87998, r89028 (Support abstraction for 'NOT IN' SQL structure). Per discussion on CR and elsewhere...we're not 100% sold on the new format yet.
Changing the database api like this should be carefully thought out before we get stuck with it for 6 more years and end up hating it.
2011-09-13 00:19:04 +00:00
Krinkle
9b9b7df01e Use a username different from the main BlockTest.php, otherwise concurrency errors occur (as seen on Jenkins builds) 2011-09-12 22:18:33 +00:00
Aaron Schulz
23d5a27e2e Reverted r86072, r86419 per CR. Lots of conflicts resolved here. Removes lineStart from r87346 code as well for preprocess parser tests. 2011-09-12 19:16:22 +00:00
Daniel Friesen
ad2869a0a6 Add some other ServicesJson tests. 2011-09-10 07:15:51 +00:00
Chad Horohoe
66c0331026 Add some basic tests to compare output of native json support and the Services_Json implementation, as I promised on wikitech-l. Could use plenty more test cases, but that should be trivial since I did it properly with data providers :) 2011-09-10 05:24:46 +00:00
Brian Wolff
57228556e6 (bug 30640; follow-up r92279) Rotating images was making skewed images
This is Bryan's patch from bug 30640 with a couple minor related changes, plus some unit tests.
This also addresses an issue with preventing too-big images from being scaled from r92279.

I also noticed that image magick's rotation support is broken in 6.3.7 (the version I had installed locally. I've since upgraded) I'm not sure if we should be doing something about that...

I did test this without both image magick, and gd (although only very briefly with gd) both seemed to work well. I didn't test any other image scalars.
2011-09-09 20:13:09 +00:00
Chad Horohoe
10a0d9d781 Gut anything from HttpTest that involves making external requests and setting cookies - the way we do this suite needs to be completely rethought.
Chalk this up as an example of how *not* to write unit tests.
Still have 5 failures :(
2011-09-08 14:04:36 +00:00
Roan Kattouw
ee44691063 Add tests for r96562. HttpTest still has 5 failing test (which is why it's marked @broken) and per Chad on IRC most of this suite is pure evil 2011-09-08 13:49:48 +00:00
Antoine Musso
41741d4dec complement r96386 tests 2011-09-07 20:28:49 +00:00
Aaron Schulz
cce7fcf367 For r91123:
* Moved generateReason() to WikiPage. This fixes the PureWikiDeletion ext too.
* Make Checkpoint ext call getRawText() as doEdit() does. Aalso, WikiPage doesn't have fetchContent().
* Call getAutosummary() statically in doEdit().
* Fixed outdated code comment.
* Fixed title used in unit test.
2011-09-07 17:55:37 +00:00
Chad Horohoe
af0eb3c320 rv r96424, Roan had his fun 2011-09-07 13:04:40 +00:00
Roan Kattouw
40aa026f48 Break some tests intentionally to see how Jenkins displays that 2011-09-07 12:48:51 +00:00
Aaron Schulz
1ec49ff3d3 Fixed typo in ipv6 private IP range list and added test (bug 30739) 2011-09-06 23:15:42 +00:00
Max Semenik
02b2c6c8db Fix for r96344: explicitly set $wgExtensionAssetsPath during tests 2011-09-06 16:47:05 +00:00
Chad Horohoe
df19f6cdea Merge ParserTestStaticParserHook into ParserTestParserHook since they practically do the same thing. 2011-09-06 14:46:58 +00:00
Krinkle
73db9698a3 Html.php: The "future"[1] is here. Add features for space-separated value attributes of html elements.
* Has been suggested since August 2009 in r54767 (doc-comment from rawElement/element function)
* Implements normalization for these attributes (removal of duplicates and redundant space)
* Adds support for arrays (instead of just string) for these attributes. 
* String are still supported, and are converted to arrays to get the same normalization.
* Wrote unit tests (which pass locally: $ php phpunit.php includes/HtmlTest.php)
* Not trigger for the media-attribute. Reason: Although some people think it's space-separated, it's actually comma-separated. Treating them as space separated might even destroy the value. [2] [3]. Neither the html4 or html5 spec documents media-attribute as space-separated, and as of HTML5/CSS3 the media attribute may contain "media queries".


[1] "In the future, other HTML-specific features might be added, like allowing arrays for the values of attributes like class= and media=" in r54767 by Simetrical.
[2] http://www.w3.org/TR/1999/REC-html401-19991224/types.html#h-6.13
[3] http://dev.w3.org/csswg/css3-mediaqueries/#background

Implementation note: I choose to have a single list of attributes that trigger this feature. Some of these attributes only support multiple values and/or are documented as space-separated as of html5 (such as accesskey), but since those attributes in general have existed in html4 as well (just different w3c spec), they are not stripped if wgHtml5 is not true. So if this feature would (eg. for accesskey) would only be done if wgHtml5=true, then people could get output like <a accesskey=Array /> depending on a configuration variable, which will get messy and make developers' life hard.
2011-09-03 03:55:23 +00:00
Krinkle
16caaa881a Whitespacing in HtmlTest.php 2011-09-03 01:42:43 +00:00
Roan Kattouw
6f1fee123b Fix a message key typo in r41961 (!!), which didn't matter before because the relevant code (and the message) wasn't reachable. 2011-08-30 11:39:43 +00:00
Platonides
9d98f581bb Manually set the title as not being a redirect. Otherwise,
it needed a database from Parser::getFunctionLang() -> 
Title::getPageLanguage() -> Title::isRedirect()
2011-08-27 21:10:41 +00:00
Sam Reed
429c16803d Fix missing $ from r95439 2011-08-24 20:15:04 +00:00
Sam Reed
30dff02424 Fixup the rest of r82577 2011-08-24 20:14:03 +00:00
Sam Reed
98d2168ffb Fix testGetTalkExceptions from r82577 2011-08-24 19:52:24 +00:00
Sam Reed
365f043fd5 Followup r82577
Remove $this->object

Swap assertEquals parameters
2011-08-24 19:32:40 +00:00
Brian Wolff
6ad3716d43 follow-up r95171 - add unit test for tracking categories. 2011-08-21 19:28:35 +00:00
Brian Wolff
4aaf9fe071 (follow-up r86169) Moar unit-tests!! (sorry for uttetly huge commit)
This should be my last commit of unit tests for the media metadata stuff (hopefully).
2011-08-21 18:05:34 +00:00
Roan Kattouw
2aa5f42df7 Followup r95072: add tests for wfMatchesDomainList 2011-08-20 10:41:44 +00:00
Roan Kattouw
39f8bf86cd Add a PROTO_CANONICAL mode to wfExpandUrl(), which uses $wgCanonicalServer 2011-08-19 15:25:50 +00:00
Alexandre Emsenhuber
327b04c44d Removed debugging code from r94932 2011-08-18 20:05:09 +00:00
Alexandre Emsenhuber
77a3987052 Moved wfGetIP() to WebRequest::getIP():
* Changed all calls in core to the latter
* Also marked wfGetForwardedFor() as deprecated
* Moved wfGetIP() tests to WebRequestTest
2011-08-18 20:03:30 +00:00
Brian Wolff
697487da5e Make testBug26425BlockTimestampDefaultsToTime be tolerrant of up to 2 seconds
difference.

Otherwise if the test happens to be run on a second barrier, it could
falsely fail (like it did just now when codur said some hurtful things
about my code failing unit-tests where it really didn't ;)

Some of the other block tests seem to itermitantly fail for no appearent
reason (null comes back instead of the block)... I don't know why.
2011-08-18 06:23:44 +00:00