Commit graph

17 commits

Author SHA1 Message Date
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
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
daniel
a1e971cd0e clear magicword cache before testing cleanSig
Without this, some other synonym for "SUBST" may be used by the parser,
because the MagicWord got cached while another content language was active
in some other test.

Change-Id: I89dc2173f6a27dcd16b0548b06070ac4244fd3cb
2012-08-29 12:31:24 +02:00
Siebrand Mazeland
4e1ccf0267 Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains reviewable.

Change-Id: I4950fdf8be669b52446290768ece0b8df8399d5d
2012-08-20 22:52:17 +02:00
Platonides
dc48a07d25 ExtraParserTest::testTrackingCategory and ExtraParserTest::testTrackingCategorySpecial need a db 2011-12-19 21:00:03 +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
Brian Wolff
6ad3716d43 follow-up r95171 - add unit test for tracking categories. 2011-08-21 19:28:35 +00:00
Brian Wolff
ec1a07889c Make the testCleanSig work no matter what $wgCleanSignatures; is in LocalSettings.php . Also have a test for when sig cleaning is disabled. 2011-08-17 22:09:57 +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
Alexandre Emsenhuber
44574b23b0 Removed hidden usage of $wgTitle in parser and the workarround in ExtraParserTest.php 2011-06-22 17:45:31 +00:00
Alexandre Emsenhuber
6ed5d02094 Also change $wgLanguageCode along with $wgContLang, this was breaking when arriving at LanguageConverterTest with "nooo!" 2011-05-25 18:37:32 +00:00
Chad Horohoe
b661588c1f Followup r83140: FakeMemCachedClient -> EmptyBagOStuff in tests 2011-03-03 12:55:22 +00:00
Platonides
fb5cebcc6d preSaveTransform() needs $wgTitle. 2011-01-23 18:43:08 +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
Platonides
9af104c4d3 Replace __METHOD__ with __FUNCTION__
Using a title like testParse instead of ExtraParserTest::testParse (thus without colons), 
means that it doesn't need to be checked if it's an interwiki, and no interwiki db (either Cdb or normal db) is needed.
So these tests can be run as Databaseless.
2010-12-27 16:51:59 +00:00
Platonides
691b4618e2 Document parser, add test cases for the external entry points to it. 2010-12-26 19:30:10 +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