Commit graph

338 commits

Author SHA1 Message Date
Timo Tijhof
5f41c8ba87 (bug 40632) Remove CleanupPresentationalAttributes feature
Removed $wgCleanupPresentationalAttributes, the associated
code it toggles and references to those in src and tests.

Also fixes bug 40329.

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

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

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

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

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

Follow-up of I2987db68 (2b0edc8).

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

Change-Id: If2198676da7e8a621d02227b42da0713f67a1de0
2012-11-16 23:28:39 +01:00
Alexandre Emsenhuber
d1be0a802e Define $wgAlwaysUseTidy to false where needed in unit tests
Tidy changes some whitespaces in the HTML which breaks the tests if enabled.

Change-Id: Ib44f60c0d4b595c76c258b41962c3c45ca21ac3e
2012-11-07 23:08:56 +01:00
umherirrender
dcb6ad0097 Use ParserOptions::newFromUserAndLang in tests
This avoids using $wgUser and $wgLang for the ParserOption, which is not
needed in the tests

Change-Id: Iea07e9a0f0898ec5f8eb98a40000f5d33b279c9e
2012-10-24 15:59:30 +02:00
Antoine Musso
c6ea55bf54 tests: always call parent setUp
Some class extending MediaWikiTestCase did not call its setUp method. We
most probably always want to do it since MediaWikiTestCase::setUp() does
garbage collection and might do more in the future.

Change-Id: I68dde370a62c8f4a779836ca0c4ad06844fdc916
2012-10-23 19:04:40 +02:00
daniel
e6c8c43356 Skip parser tests if main NS isn't wikitext.
Change-Id: Ie3267e4db4246d522b6564204e9688258fc41324
2012-10-12 15:39:01 +02:00
Brion Vibber
966cda2f80 Initial stab at responsive images for screen densities.
* adds $wgResponsiveImages setting, defaulting to true, to enable the feature
* adds 'srcset' attribute with 1.5x and 2x URLs to image links and image thumbs
* adds jquery.hidpi plugin to check pixel density and implement partial 'srcset' polyfill
** $.devicePixelRatio() returns window.devicePixelRatio, with compat fallback for IE 10
** $().hidpi() performs a 'srcset' polyfill for browsers with no native 'srcset' support
* adds mediawiki.hidpi RL script to trigger hidpi loads after main images load

Note that this is a work in progress. There will be places where this doesn't yet work which output their imgs differently. If moving from a low to high-DPI screen on a MacBook Pro Retina display, you won't see images load until you reload.

Confirmed basic images and thumbs in wikitext appear to work in Safari 6, Chrome 21, Firefox 18 nightly on MacBook Pro Retina display, and IE 10 in Windows 8 at 150% zoom, 200% zoom, and 140% and 180%-ratio Metro tablet sizes.

Internally this is still a bit of a hack; Linker::makeImageLink and Linker::makeThumbLink explicitly ask for 1.5x and 2x scaled versions and insert their URLs, if different, into the original thumbnail object which (in default handler) outputs the srcset. This means that a number of places that handle images differently won't see the higher-resolution versions, such as <gallery> and the large thumbnail on the File: description page.

At some point we may wish to redo some of how the MediaHandler stuff works so that requesting a single thumbnail automatically produces the extra sizes in all circumstances. We might also consider outputting a 'srcset' or multiple src sizes in 'imageinfo' API requests, which would make ApiForeignRepo/InstantCommons more efficient. (Currently it has to make three requests for each image to get the three sizes.)

Change-Id: Id80ebd07a1a9f401a2c2bfeb21aae987e5aa863b
2012-10-11 10:54:21 -07:00
Timo Tijhof
181c7cdc8e Clean and repair many phpunit tests (+ fix implied configuration)
This commit depends on the introduction of
MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4.

Various tests already set their globals, but forgot to restore
them afterwards, or forgot to call the parent setUp, tearDown...

Either way they won't have to anymore with setMwGlobals.

Consistent use of function characteristics:
* protected function setUp
* protected function tearDown
* public static function (provide..)

(Matching the function signature with PHPUnit/Framework/TestCase.php)

Replaces:
 * public function (setUp|tearDown)\(
 * protected function $1(

 * \tfunction (setUp|tearDown)\(
 * \tprotected function $1(

 * \tfunction (data|provide)\(
 * \tpublic static function $1\(

Also renamed a few "data#", "provider#" and "provides#" functions
to "provide#" for consistency. This also removes confusion where
the /media tests had a few private methods called dataFile(),
which were sometimes expected to be data providers.

Fixes:

TimestampTest often failed due to a previous test setting a
different language (it tests "1 hour ago" so need to make sure
it is set to English).

MWNamespaceTest became a lot cleaner now that it executes with
a known context. Though the now-redundant code that was removed
didn't work anyway because wgContentNamespaces isn't keyed by
namespace id, it had them was values...

FileBackendTest:
* Fixed: "PHP Fatal: Using $this when not in object context"

HttpTest
* Added comment about:
  "PHP Fatal: Call to protected MWHttpRequest::__construct()"
  (too much unrelated code to fix in this commit)

ExternalStoreTest
* Add an assertTrue as well, without it the test is useless
  because regardless of whether wgExternalStores is true or false
  it only uses it if it is an array.

Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
2012-10-09 03:01:51 +02:00
umherirrender
a2e470ee68 (bug 32951) Do not register absolute internal externals
Setting $wgRegisterInternalExternals = false for proto server should not
store the http/https links in externallinks table

Also fix detection of own links for links with query or anchor or
nothing

new also detected:
//localhost
//localhost?query
//localhost#anchor

already detected:
//localhost/path

Change-Id: Idd03d309cc3b71728a8cbea460efa12b10348d64
2012-10-03 23:15:38 +00:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
Alexandre Emsenhuber
7f9f359edf MessageCache::destroyInstance() is static.
So there is no point calling it using
MessageCache::singleton()->destroyInstance()

Change-Id: Ie4e10284b4b911fff018c52a2a680452601f8288
2012-08-16 10:00:45 +02:00
Daniel Werner
aaf45a0b75 New hook 'ParserTestGlobals'
Allows to set globals before running parser tests.

Change-Id: Iea057b992b260611bca7f3adade2c8214b0dcea2
2012-08-14 00:18:50 +02:00
Antoine Musso
12e608e3d5 converts '@fixme' to '@todo FIXME'
@fixme is simply not recognized by doxygen whereas @todo is used to
generate a nice ... todo list!!

Change-Id: If956c0a164373126ce48b791d45c56962034eecd
2012-07-10 17:16:46 +02:00
Platonides
1896e83ff2 Class renaming didn't went into change 12729
Change-Id: I0e5eff79a41662c89d111eaf0f13c35d9a689dde
2012-06-23 23:04:57 +02:00
Platonides
a05c1a1ab7 WikiPage::preSaveTransform() was deprecated in r103228 (018d885f)
Hide the warning on the tests and add tests for the Parser method.

Change-Id: I939bf59206da1dd45e33db2251e92d9792a0a767
2012-06-23 20:28:51 +02:00
Christian Aistleitner
cc13cf0564 Increase permitted runtime for testParserTest
Change-Id: Id8a73b2d5d32af38c6856c3120394a2d6150f835
2012-04-20 20:00:36 +02: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
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
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
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
Platonides
4fc7769069 Revert r108358. It's a good fellow and we like to keep it. 2012-01-09 22:33:00 +00:00
Chad Horohoe
6cc1277748 Remove no-op codepath 2012-01-09 13:04:05 +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
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
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
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
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
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
Chad Horohoe
d04fac7853 Comment tweak on MediaWikiParserTest and make ResourceLoaderTest extend MediaWikiTestCase 2011-11-12 21:32:39 +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
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
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
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
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
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
Sam Reed
6906724935 Add, update, tweak documentation
Fix document comment blocks

Tweak some returns
2011-10-26 03:45:13 +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
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
Daniel Friesen
7a1d3bf06a Followup r98056; Add to this screwed up NewParserTest phpunit stuff as well. 2011-09-26 02:04:17 +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
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
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
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
Brian Wolff
c909720031 Follow-up r94680 - fix unit tests.
The way the magic variable unit tests are run looks a little sketchy to me...
2011-08-17 00:46:58 +00:00
Chad Horohoe
1015bf5986 Followup r94678: remove some include and autoload entries. tests still passing 2011-08-16 19:25:26 +00:00
Chad Horohoe
b11588e827 Remove ParserHelpers. NewParserTest still needs some cleanup, but it doesn't rely on this. All tests still pass. 2011-08-16 19:18:07 +00:00
Alexandre Emsenhuber
062e2723ba Some misc fixes to tests:
* Don't create a WebRequest instance to put in $wgRequest in test since it is meant for HTTP requests, not command line ones
* Force $wgAlwaysUseTidy to false in ExtraParserTest, having it to true breaks testBug8689() and testParse()
2011-08-16 15:17:35 +00:00
Chad Horohoe
5f8e4b019b Move the fuzz test into @group Broken so it will shut up about being incomplete 2011-08-09 16:13:56 +00:00
Alexandre Emsenhuber
762c3f8204 * Call Linker methods statically
* Use INSERT IGNORE for the site_stats row (as for the interwiki entries); was throwing query error about duplicate row on my installation
2011-08-05 15:17:19 +00:00
Chad Horohoe
04b80879ce Partial fix for r88772: no need for IGNORE on site_stats, just interwiki 2011-08-04 23:14:17 +00:00
Sam Reed
66e01d1bb7 Adding __METHOD__ to parameters passed to wfMkdirParents() 2011-07-25 22:01:19 +00:00
Chad Horohoe
d80b53f982 self rv r90483. Still needs investigating though 2011-07-21 22:04:55 +00:00
Alexandre Emsenhuber
f82b49e02b Pass the Title object to Parser::transformMsg() 2011-06-29 10:58:54 +00:00
Chad Horohoe
d12cc8a163 Mark test incomplete for a legitimate reason like trying to serialize a PDO object--rather than imaginary ones such as blaming memory_limit being too low when the test was being stupid and lowering it for us. 2011-06-20 20:24:53 +00:00
Platonides
efbd16e825 Copy teardownUploadDir(),deleteFiles(),deleteDirs() from parserTest.inc Move down teardownGlobals()
This almost fixes the issue of hundreds of leaking mwParser-*-images files at temp dir.
For some unknown reason, there's still one instance left, though.

PS: I thought I had committed this time ago...
2011-06-16 21:07:37 +00:00
Chad Horohoe
c954cb7a4c * Remove @static from the last few places it's left in core. Please don't use this silly annotation anymore, that's what the static keyword is for.
* Enforce protected on SpecialAllPages::getNamespaceKeyAndText(), it's not @private like the comment implies
* Drop User::getMaxID(), nothing uses it
2011-06-14 01:56:55 +00:00
Happy-melon
295f513e8b More unpicking of r85288. I think this is all of the magic method calls, but they're very hard to grep for (part of the problem with them!), so let's leave the calls in with a wfDeprecated() for a while... 2011-06-03 11:04:49 +00:00
Chad Horohoe
db833df9dc Remove useless bootstrap inclusions 2011-06-03 04:25:21 +00:00
Antoine Musso
dacec03bde really add NewParserTest to the Stub group
PHPUnit 5.3.13 does not like having comments after the '@group name' command.
This class was not part of the Stub group and run despite the exclusion of
the Stub group in our suite.xml

Properly fix issue described in r89223 and complete r89226
2011-05-31 20:35:35 +00:00
Platonides
6c2654b7f8 Revert r89223. MediaWikiParserTest is needed to run all the $wgParserTestFiles
NewParserTest.php standalone running of the first $wgParserTestFiles item is just a convenience.
2011-05-31 20:30:12 +00:00
Antoine Musso
d24a26e713 NewParserTest.php can now work independently
PHPUnit load class according to their order on the filesystem I guess.
On the cruisecontrol host, it first load NewParserTest.php and run
the test then load MediaWikiParserTest.php which run the tests too!

On my host the order is reversed, and NewParserTest.php is never run
for a reason I have not investigated.

Anyway, deleting the MediaWikiParserTest.php is harmless since it is
redundant with NewParserTest.php

(should fix cruise control)
2011-05-31 19:51:48 +00:00
Chad Horohoe
b7bc5a8db5 Workaround for duplicate key errors 2011-05-25 00:49:51 +00:00
Chad Horohoe
26ec01f63c Extend MediaWikiTestCase in a few places 2011-05-25 00:30:06 +00:00
Happy-melon
8ff0177e98 Follow-up r85403: rm unwanted "new" declaration. 2011-05-23 18:57:30 +00:00
Alexandre Emsenhuber
236e3fd6c6 Follow-up r88653: removed the remaining of OutputPage's stubbing 2011-05-23 17:53:31 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Platonides
e849a1f153 Tag names can't contain template parameters (thanksfully) 2011-05-04 14:40:25 +00:00
Platonides
cbceed01fa Follow up r87220. r86795 tests are now embedded into PreprocessorTest.php 2011-05-03 19:53:13 +00:00
Platonides
c6a8d96092 We can't check if it's a parentNode->type == name_node so early, since
it may be just a single } and end up being a literal.
2011-05-03 19:48:50 +00:00
Platonides
e5a26f3460 Convert r86795 tests into a dataProvider 2011-05-01 21:33:16 +00:00
Happy-melon
21813a563c Follow-up r86775: restub $wgLang. Not because it's a good idea, but because I can't see how to avoid the circular dependencies on it *without* stubbing it. Probably easier to just continue the drive to deprecate the global variable altogether. 2011-04-24 10:50:51 +00:00
Mark A. Hershberger
2e6a9b9cea * Add preprocessor tests that Bergi supplied for Bug #28642
* Add Bergi to CREDITS
2011-04-23 21:26:04 +00:00
Mark A. Hershberger
7d90f16834 Use assertStringEqualsFile in place of assertEquals and reading the file. 2011-04-23 21:21:02 +00:00
Mark A. Hershberger
e8ccedbbf0 missed some w/s 2011-04-23 21:18:50 +00:00
Mark A. Hershberger
6c3d0e056e w/s cleanup 2011-04-23 21:18:22 +00:00
Happy-melon
c80535ae10 Stop stubbing $wgLang and $wgContLang. There are no major code paths which do not call either $wgLang or $wgContLang at least once. All index.php calls unstub $wgContLang from MediaWiki::parseTitle() except in the edgecase of viewing pages referenced only by "curid=123", and since those will end up calling OutputPage::output() they will eventually be unstubbed at some point as well. All calls through load.php unstub $wgLang in ResourceLoaderContext::getLanguage() from ResouceLoader::respond() --> ResourceLoader::preloadModuleInfo(). All calls through api.php unstub $wgContLang in ApiResult::cleanUpUTF8() from ApiMain::printResult(). 2011-04-23 15:19:38 +00:00
Platonides
9f63d96785 Change tests to match preprocessor changes in r86072.
sed -i 's/<root><\(template\|tplarg\)>/<root><\1 lineStart=\\"1\\">/' phpunit/includes/parser/PreprocessorTest.php
sed -i 's/<root><\(template\|tplarg\)>/<root><\1 lineStart="1">/' parser/preprocess/*.expected
2011-04-19 18:39:37 +00:00
Sam Reed
0bf458ec62 Apply phase3 related Title fixes. With one minor addition, Title constructor marked as protected, "just in case"...
Patches by Yuvi Panda

From (bug 28583) Remove all /* private */ declarations in MediaWiki core
2011-04-18 23:20:21 +00:00
Platonides
c878cd608f r85553 fixup. When there are variants involved, the line
$GLOBALS['wgContLang'] = $context->lang;
is not assigning $wgContLang the same $langObj instantiated a couple of lines above, but a different object obtained from the user code, breaking variant parsertestsw..
2011-04-06 21:36:07 +00:00
Happy-melon
f121f89674 Follow-up r85403: fix fatal in parser tests. 2011-04-06 17:39:18 +00:00
Happy-melon
625695317e Follow-up r85302: update OutputPage constructors in core. 2011-04-05 00:06:47 +00:00
Platonides
25a338f5e0 Add a couple of brace test cases. 2011-03-30 17:41:58 +00:00
Antoine Musso
8012c3b188 debugging statement when starting a phpunit parser test 2011-03-18 21:45:32 +00:00
Platonides
95f1076f20 Remove unused globals 2011-03-06 23:28:32 +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
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
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
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
db7d7ebd28 Don't use ob_start/ob_get_contents/ob_end_clean just to var_dump() a string. Cleaning var_dump() usage. 2011-02-09 17:21:39 +00:00
Antoine Musso
7675773aa9 Move some providers in new MediaWikiProvide class
The MediaWikiProvide class would host providing methods reused in different
tests classes.  To use it, just use the Class::function syntax.

Example:
  /** @dataProvider MediaWikiProvide::Months */

Made a svn copy of phpunit/includes/parser/MagicVariableTest.php
to save the history.
2011-02-06 21:28:57 +00:00
Platonides
fd84fbf739 Fix problem when running a fakePipeFound, which could lead to literals being incorrectly added to the part node instead of the value node. 2011-02-05 20:05:00 +00:00
Antoine Musso
596956c928 Test suite for revisions and date related magic variables.
Tests should be carefully reviewed, please note there is are exceptions
for 'revisionday' and 'revisionmonth1' magics which are hardcoded in
the parser to return an integer.

Follow up r66200

TESTS:

$ php phpunit.php -c suite.xml --filter MagicVariable --testdox
PHPUnit 3.5.10 by Sebastian Bergmann.

MagicVariable
 [x] Currentday is un padded
 [x] Currentdaytwo is zero padded
 [x] Localday is un padded
 [x] Localdaytwo is zero padded
 [x] Currentmonth is zero padded
 [x] Currentmonthone is un padded
 [x] Localmonth is zero padded
 [x] Localmonthone is un padded
 [x] Revisionday is un padded
 [x] Revisiondaytwo is zero padded
 [x] Revisionmonth is zero padded
 [x] Revisionmonthone is un padded
$
2011-02-02 21:04:21 +00:00
Alexandre Emsenhuber
51c6afc751 * Replaced $wgMessageCache by MessageCache::singleton(); since we only use one instance of this class (as for ParserCache, LinkCache)
* MessageCache::singleton() calls wfGetMessageCacheStorage() directly instead of using $messageMemc, just in case this would be called before that variable is set
* Per TimStarling: also removed deprecated methods in MessageCache class: addMessages() and related, [get|set|enable|disable]Transform(), loadAllMessages(), loadMessageFile() and some others. Same for the legacyData stuff in LocalisationCache that was only used by MessageCache::addMessages() and related. 
* Converted remaining extensions
2011-01-26 15:42:04 +00:00
Platonides
86a4780482 Missed the case where there is an equals.
It's ugly having to add that literal node there.
2011-01-24 22:10:22 +00:00
Platonides
70856c881a Silly bug with value nodes. 2011-01-24 19:40:25 +00:00
Platonides
8a6475bd70 Don't look for pipes in the root node. 2011-01-22 16:34:14 +00:00
Platonides
069765d4b6 Add full articles to preprocessor tests.
* QuoteQuran.txt is GFDL/CC-BY-SA, created by [[en:User:Striver]] at http://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988
* Factorial.txt is GFDL + CC-BY-SA, created by [[en:User:Polonium]] at http://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 
* All_system_messages.txt was generated by MediaWiki, so already GPL. Copied from http://tl.wiktionary.org/w/index.php?title=Suleras:All_system_messages&oldid=2765

Added along their preprocessed xml.
2011-01-21 23:03:33 +00:00
Platonides
f6763bdb88 The << operator (level 7) has greater priority than bitwise or (level 12),
which makes getNextSibling() function wrong for values >= 256.
2011-01-21 22:00:07 +00:00
Platonides
0745a738b1 The pipes were no recognized after a link. A one line fix in the code :) 2011-01-19 20:46:00 +00:00
Platonides
63eea0f737 Follow up r80461. In some cases the closing tags for internal tags were not recognised. 2011-01-17 23:12:07 +00:00
Platonides
8081138adb Follow up r80376. Added missing file FORMAT.
Fixed method call in Preprocessor_Native.php.
Added support for tags containing spaces (r80025), following the same odd order dependant behavior as the php preprocessors.
Extensions shouldn't rely on it. See http://thread.gmane.org/gmane.science.linguistics.wikipedia.technical/51496 
As a result of these changes, there is much less worst-case lookahead now.
in_array.{c,h} are now unused.
2011-01-17 19:54:44 +00:00
Platonides
a8dce135d9 Another couple of tests. Also passed by the NtPrepro :) 2011-01-16 18:20:44 +00:00
Platonides
0127c7c446 Add preprocessing tests 2011-01-15 08:35:56 +00:00
Platonides
5ceb97cfc3 Follow up r80025.
The space is actually used inside extensions, such as Maps, covertly called as 'display_map' into 
Validator, then converted into 'display map' by getName().
2011-01-12 00:11:11 +00:00
Platonides
8f87d873fa Add tests for parser tag hooks. 2011-01-11 18:37:15 +00:00
Chad Horohoe
38babb25b5 More silly whitespace 2011-01-10 18:43:59 +00:00
Chad Horohoe
c12dcf7101 rm big whitespace 2011-01-10 18:41:31 +00:00
Platonides
fa08f3be62 $messageMemc is used as local variable in line 63, function setUp
$messageMemc is used as local variable in line 74, function setUp
2011-01-05 23:54:07 +00:00
Sam Reed
da2c995df1 Remove unreachable return;
Add missing global $IP;
2011-01-03 03:40:26 +00:00
X!
9012b54101 Mark broken parser tests as broken 2011-01-03 02:49:52 +00:00
X!
1b4c6a0254 Fix r79447: Remove debugging code 2011-01-01 22:19:22 +00:00
Platonides
1cb56fc8e3 Remove unused globals 2011-01-01 22:16:58 +00:00
X!
27618d012b Followup r79443: Add some form of organization to the test autoloader 2011-01-01 22:16:54 +00:00
X!
c667c3f1be Reorder functions around, add some form of order to the test suite.
It'd be nice to break some of these functions out to another class, but then again, 
I'd also like to see Windows actually become stable, MediaWiki to become fully class based, 
and Google to stop taking over the world. We can't all have what we want.
2011-01-01 20:57:13 +00:00
X!
2b8f832da8 Add fuzz tests to new parser tests (someone else should make sure this works as expected) 2011-01-01 18:10:28 +00:00
X!
37279160f3 Don't use the --verbose option anymore 2011-01-01 17:05:08 +00:00
X!
332e01addf Add parsertest specific help to PHPUnit.php 2011-01-01 06:49:00 +00:00
X!
f8d74604fd More work on new parser tests:
-No need to specify a new function for each argument, use PHP5 magic to automatically set it
-Create (g|s)etCliArg() functions
-Implement some features from the old parser tests
2011-01-01 05:53:04 +00:00
X!
34fc833407 Start work on porting ParserTests completely into PHPunit.
Disable temporary tables, a few reports of them not working. The tables get deleted anyway, so why risk it?
2011-01-01 03:39:37 +00:00
Platonides
c3dfabcf6d This global declaration is now unused. 2010-12-30 16:19:10 +00:00
X!
194ab8bb57 Self-reverting my reversion of r79154 in r79158. The old version is flawed and broken beyond belief. At least this version works. 2010-12-29 16:40:31 +00:00
Platonides
3aa8a1d61a Replace the global $additionalMWCLIArgs with a class variable.
Provide a default value for verbose since it is checked regardless of existance.
2010-12-29 16:24:59 +00:00
X!
05c6b53899 Partial revert of r79154. hexmode asserts that these work, even though I keep getting OK (0 tests, 0 assertions) 2010-12-29 03:35:17 +00:00
X!
edbf743aeb Make MediaWikiParserTest work now in PHPUnit. There are still a few bugs, such as stopping tests if one fails,
lack of fuzz testing and other parser test options, and the DB creation is still a little flaky.
A MediaWikiPHPUnitCommand class had to be created to allow for custom CLI parameters.
2010-12-29 02:23:51 +00:00
Chad Horohoe
447529064b * verbose and color default output from phpunit
* Make a bunch of tests subclass MediaWikiTestCase
* Parser tests and ResourceLoaderTest can't subclass it yet due to various issues
2010-12-28 18:17:16 +00:00
Chad Horohoe
5f528203aa Rename MediaWikiTestSetup to MediaWikiTestCase: this is going to be the base class for all unit tests from now on 2010-12-28 17:45:33 +00:00
Chad Horohoe
65652a6f33 Fix path changes from move in r78383 2010-12-14 16:33:06 +00:00
Chad Horohoe
23f69f10ed Per wikitech-l discussion: Move tests from maintenance/tests/ to tests/. They're not strictly maintenance scripts, and some people want to do a selective checkout that doesn't include the tests. There's still debate on whether we should include these in the release downloads, but we had a pretty firm consensus to move this. 2010-12-14 16:26:35 +00:00