Commit graph

15 commits

Author SHA1 Message Date
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
umherirrender
2b021dc48a Fixed spacing
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif

Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
2014-07-19 23:12:10 +02:00
Reedy
495040e614 Update Language::userAdjust() $ts parameter hint to be string
Will technically still take an int (it's parsed around anyway), but
should be passed as a string

Mostly for HipHop stuffs

Change-Id: Id940028d581e34ca2e37a0730ca5766a08fc10e2
2014-06-18 23:00:23 +01:00
addshore
fb16eb2abe Add more @covers tags and test cleanup
Other cleanup includes
 - Adding method scopes
 - Fixing php comments
 - Adding todos

Change-Id: I0a231008e6a59110ffcab6af1bd8c4d3ee13f21d
2013-10-22 08:59:42 +00:00
umherirrender
9e01dd3478 TimeAdjustTest: Use dataProvider
Also removes setting of wgContLang/wgLanguageCode, because test extends
MediaWiki*Lang*TestCase

Change-Id: I8a24fbe161c8f2ecae7591baf99845ff4434f983
2013-03-23 11:17:02 +00:00
Siebrand Mazeland
7a24666935 Update formatting
2 of n.

Change-Id: I5406673e99ed53e4e330ed47f022a17177544daa
2013-02-14 12:36:35 +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
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
Antoine Musso
86021805a4 Revert "(bug 32297) Use symbolic names, not offsets for a default timezone."
This reverts commit 3056b8dfd2.

Change-Id: I29cf9a5389709b30f869072ed836cb5b85ba5106
2012-07-02 13:12:16 +02:00
Szymon Świerkosz
3056b8dfd2 (bug 32297) Use symbolic names, not offsets for a default timezone.
Change-Id: I4a12487487bbb7897911b13068e2d7a1340e7206
2012-05-04 19:00:01 +02:00
Brion Vibber
1cc4bae5f8 Followup to r90090 -- thou shalt add parent:: calls to both overridden tearDown *and* overridden setUp ()
Had been resulting in fatal errors when running TimeAdjustTest, due to trying to use an old $wgContLang value that had never gotten saved properly because the parent class setUp() was not called.
2011-06-15 20:51:17 +00:00
Platonides
de2cdf3fc5 Thou shall call parent::tearDown(), MediaWikiLangTestCase child.
Follow up r87210. This has been hurting my tests for weeks.

Made TimeAdjustTest extend MediaWikiLangTestCase.
2011-06-14 21:21:26 +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
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