Commit graph

22 commits

Author SHA1 Message Date
umherirrender
a925980036 Make TitleMethodsTest a LangTestCase
With I40a51c14ce07c301c15c6c2128cc18bb12e71103 a compare of namespaces
was added which fails when content language is not en.

Change-Id: I21466231e10e6cd5969c8c9bfd4824bf9c47e6d8
2014-12-30 10:22:56 +01:00
Kunal Mehta
24c000ea80 Add and use Title::getOtherPage()
Change-Id: I40a51c14ce07c301c15c6c2128cc18bb12e71103
2014-12-04 17:45:05 -08:00
umherirrender
7ff005407e Remove colon after @deprecated/@param/@todo/@note
Change-Id: I4e66dad85eecf7e8e03ac760af900395e1bc11b6
2014-07-24 11:30:25 +02:00
aude
71cf107f99 Make setUp and tearDown protected in tests
These are protected in the parent MediaWikiTestCase and
PHPUnit_Framework_TestCase. No good reason to make them public.

Change-Id: I45ecc0e4209f0c3b27e63a550112e4e0ddf6e530
2013-11-24 01:48:09 +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
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
umherirrender
7d8a184bac Tests: Fix case of some methods
Change-Id: Iab247f805410f2e9157d325edd80880538a3e54c
2013-03-22 17:44:34 +01:00
umherirrender
0fc445c19b Adding missing @group Database to unit tests
Reasons:
* Signature parsing
* GenderCache
* Using TestUser class (inside ApiTestCase)

Change-Id: Iea4e9f9cafaa3afe7da8b922644061d3d575afe3
2012-12-09 10:27:56 +01:00
Platonides
84e1e6b5ae Removal of unused globals.
Change-Id: I870665d18f955a245222cfceca4665897277e7e4
2012-11-26 22:15:11 +01: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
329d5b3516 Merge branch 'Wikidata' into master.
This introduces the ContentHandler facility into MediaWiki,
see docs/contenthandler.txt.

For convenient review, a squashed version is available at
https://gerrit.wikimedia.org/r/27191

The ContentHandler facility is a major building block of the Wikidata project.
It has been discussed repeatedly on wikitech-l.

Change-Id: I3804e2d5f6f59e6a39db80744bdf61bfe8c14f98
2012-10-09 11:34:24 +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
63f42295c3 Don't assume main namespace contains wikitext
Change-Id: Ie5bb593f850ab97b2e63f064e3fc52bc17edfdd1
2012-09-20 16:18:30 +02:00
daniel
01f36b721f merged latest master 2012-05-14 23:24:18 +02:00
daniel
cbc2014b2d Use integers for content_model and content_format.
Representing content_model and content_format as integers in the
database was suggested by Asher mainly to save space.

This change entails some refactoring and renaming, but no big
change in logic.
2012-05-14 10:22:52 +02:00
daniel
d85bbb1074 Adding more tests for Title.
This introduces tests for isCssJsSubpage, isCssOrJsPage, and isWikitextPage.

New tests are added to avoid regressions when the ContentHandler facility is introduced.

Change-Id: I68987490b01242cc0bcdc0d9dfaa99f1227f71a0
2012-05-02 19:32:56 +02:00
daniel
db596107a4 spaces -> tabs 2012-04-26 12:11:34 +02:00
daniel
ce4a6e26ea reset namespace caches when testing extra namespace handling 2012-04-26 12:11:01 +02:00
daniel
57cf7bd82c more tests for Title 2012-04-19 12:55:46 +02:00
Reedy
9e33a6c740 assertEquals is $expected, $actual, not $actual, $expected
Fix Title related tests that are the wrong way round (noticed by Daniel Kinzler
when creating more tests, and wondering why phpunit was making error messages
that didn't make any sense!)

public static function assertEquals($expected, $actual, $message = '',
    $delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE)

Change-Id: I09aeb7cb7edb8e486ccf2f54673f91cd9704cd3b
2012-04-18 16:03:46 -07:00
daniel
e02f9b1706 first test cases. found and fixed a bug in Title::isCssJsSubpage 2012-04-18 15:02:21 +02:00
Daniel Friesen
3414e91bae Implement a number of namespace related equals functions:
* MWNamespace::equals to test equivalence of two namespaces (forward compatible with any changes we may make like introducing namespace keys like 'USER')
* MWNamespace::subjectEquals to test equivalence of the subject of two namespaces e.g.: MWNamespace::subjectEquals( NS_USER, $ns ); instead of testing for equivalence to both NS_USER and NS_USER_TALK
* Title::inNamespace to use instead of $title->getNamespace() == NS_???
* Title::inNamespaces for use like $title->inNamespaces( NS_USER, NS_PROJECT ) when you only care if it's in one of a number of namespaces (also accepts an array)
* Title::hasSubjectNamespace for use instead of testing for equivalence to both the subject and talk such as NS_USER and NS_USER_TALK.

Include phpunit tests for all this new code, and also add some tests for some existing code.
2011-11-22 13:34:55 +00:00