Commit graph

6 commits

Author SHA1 Message Date
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
Siebrand Mazeland
59ec5a325c Move api/ApiTestUser.php to TestUser.php and make available in MediaWikiTestCase class.
* Renamed class ApiTestUser to TestUser.

Change-Id: I1c3c659c3ba5c54a314d879132f760008983372d
2012-09-13 18:40:23 +00:00
umherirrender
3098babc35 enable email for PreferencesTest.php
The tests in PreferencesTest.php checking email things,
enable email to let the test run complete and not depend on the wiki
setting.

Change-Id: I21b34b31c52a10e0f4f6b918ee25d98a97ea5981
2012-04-30 09:29:45 +02:00
Antoine Musso
160a471957 (bug 34302) Add CSS classes to email fields in user preferences
Patch by Nischay Nahata whom I have mentored earlier this week.
2012-03-07 09:56:24 +00:00
Antoine Musso
2741323b9b amend r113016 , that was for bug 34302 2012-03-05 11:50:30 +00:00
Antoine Musso
3c098d1da5 place holder to test bug 34919 when it is fixed 2012-03-05 11:48:35 +00:00