Commit graph

26 commits

Author SHA1 Message Date
Siebrand Mazeland
1fb1fa4601 Pass phpcs-strict on some test files (1/x)
Change-Id: I7f8dee09ac734cbc369441431841f2d4aa5d7f51
2014-04-24 17:05:32 +02:00
addshore
9e85aabe52 Cleanup a bunch of tests and add todos
Change-Id: Iae44427edee3ed2a62abdb5a8f5d9f1ed2e7d660
2014-03-09 15:12:45 +01:00
addshore
9c540db2df @covers tags for inclues/*Test
Change-Id: Id28acdd8fe0028bf1e46344cfed131076c8f4c95
2013-10-24 11:54:02 +01:00
addshore
de7af7ac2c Fix scope on all /phpunit test methods
Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
2013-10-24 10:31:32 +02:00
Aaron Schulz
e8e2474c8f Revert "Misc follow-ups to I2fc3966e (a161c5e)"
That apparently caused bug 46397.

This reverts commit 388b14a15d


Bug : 46397
Change-Id: Ideaa86f0d535873a08e27d6f98f6bd4255b8c594
2013-03-22 21:24:58 +00:00
umherirrender
ff3485ec99 Tests: Use more setMwGlobals
Change some tests to use setMwGlobals to have restoring of globals after
the test.
This also removes some save/restore code, which is not needed, due to
the automatically restoring on tearDown with setMwGlobals.

Change-Id: I8d2ac9f6cc14f0bd4ee8eb851c09f2e71babc6e0
2013-03-21 20:35:44 +01:00
Alexandre Emsenhuber
388b14a15d Misc follow-ups to I2fc3966e (a161c5e)
- Also add LinkCache::addLinkObj() calls to isRedirect(), getLength() and getContentModel()
- Changed error messages when LinkCache returns null, since this really should not happen anymore
- Removed incorrect comments
- Only use the value of the member variable if GAID_FOR_UPDATE is not passed
  (for consistency between the three methods)
- Mark tests that need database access as such due to the call to Title::getContentModel()
  (generally called through Parser::getFunctionLang())

Change-Id: I84e0c47cdf7412f2b7fa5f296d066b64b7bbfd42
2013-02-18 13:31:55 +01:00
Siebrand Mazeland
ac63001d8e Update formatting
1 of n.

Change-Id: I852729f08bbb0c5e39c2db44362ccdc7f59dcc08
2013-02-14 12:22:13 +01:00
Antoine Musso
0fd05285d7 pass codesniffer on tests/
Fix almost all occurences of the following sniffs:

Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility

Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
2013-01-28 12:14:26 +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
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