Commit graph

13 commits

Author SHA1 Message Date
umherirrender
e10ee4304e Adjust indent of some comment blocks
Change-Id: Ic25419490fa6a35c11ccc2b7810527e6661e027c
2014-05-01 18:46:34 +00:00
addshore
46a17d0fc3 Cleanup /languages/* tests
This change:
 - Adds method scope
 - adds @covers tags
 - adds various @todos
 - fixes some comments

Before the changes tests ran with:
   1383 tests, 1412 assertions 10 skips
After changes the results remain the same

Change-Id: Iee57447bdb47026952ef5dcce6fed5dad0f80e52
2013-10-22 12:32:29 +02:00
Siebrand Mazeland
6da93fc6f6 Update code formatting
Also update some previous inconsistencies pointed out by Krinkle in change IDs:
* Ide20743a2e84ff68549286120e6cff9d9f396f54
* I811ca957b6588085d67606ebc0cd4033a1e53839

Change-Id: Ife33b931870d0d7e04fcb40974997436d27f528f
2013-03-27 14:15:11 +01:00
Amir E. Aharoni
40c01f2492 Update plural rules for Hebrew
A recent CLDR update changed the plural rules for Hebrew
and added a "many" form. That rule has a mistake, however -
it is not supposed to include the number 10. This is reported as
http://unicode.org/cldr/trac/ticket/5828

This commit updates the plural overrides for Hebrew and makes
them closer to the latest CLDR, but with a fix for that rule.

It also updates the tests to include support for the new rule
and to make sure that the right fallbacks are used when
less than four rules are supplied, because usually that is
the case. It is thus a partial revert of the changes introduced
in I3d72e4105f6244b0695116940e62a2ddef66eb66 .

Mingle-Task: 2715

Change-Id: I1315e6900ef7a89bf246e748b786f7fc31a629c6
2013-03-22 15:21:50 +02:00
Timo Tijhof
b36d883017 Tests: Make phpunit providers "public static".
Follows-up I9d2b148e57 (including phpunit/languages this time).

Bug: 46434
Change-Id: I30e5efcd88c516121c454676bd7a18f9b7c8fca6
2013-03-22 03:12:37 +01:00
Kaldari
06b0967caa Allow the retrieval of the plural rule type for a given number
For example, find out which rule type should be applied for 5 items
in Arabic. The result would be 'few'.

This implementation should be non-disruptive and completely backwards
compatible (which is the main reason it isn't a lot simpler).

Change-Id: I3d72e4105f6244b0695116940e62a2ddef66eb66
2013-03-20 14:34:12 +05:30
Siebrand Mazeland
feb9419a51 Update formatting
7 of n.

Change-Id: I07687a4381f29fd9fc73666e460f25769ed54092
2013-02-15 12:53:41 +00:00
Amir E. Aharoni
b6664e6dc8 Add grammar tests for Hebrew
Change-Id: I0114c87ec63cc224f42c81497af41fe6e72a59bc
2012-11-10 15:15:27 +05:30
Antoine Musso
a03bf9e27f tests: rm duplicate code in language classes
The language classes have been using the same setUp() tearDown() to
craft a new language object. I have abstracted that code in
LanguageClassesTestCase and made all the language test classes to extend
it. The language is interpolated directly from the class name and an
object for it can be retrieved with the getLang() method.

Change-Id: Ib931336ce219edabe2c72b7e9f04c976a500723e
2012-10-29 09:40:30 +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
Santhosh Thottingal
bbbcf089db CLDR Plural rules based plural form calculation
* Use the plurals.xml of CLDR for the plural rules of languages
* Use plurals-mediawiki.xml to override or extend the rules inside MW
* Remove the convertPlural method in each LanguageXX.php
* Parse and load the xml files in LocalisationCache
* Use the CLDRPluralRuleEvaluator.php for parsing the cldr plural rules
  (This is taken from Translate extension and might require a replacement
   parser without using eval)
* Add getPluralRules() to make the CLDR plural rules available to JS.

PS3: More method documentation, cleanup

Change-Id: I58a9cdfe60c7b9027bf031c91370472054f04ae2
2012-08-16 11:45:17 +10:00
Amir E. Aharoni
adf5248562 Testing the case when dual is not provided. 2012-01-31 14:42:38 +00:00
Amir E. Aharoni
b8cc074d88 Adding tests for plural in Hebrew. 2012-01-31 13:49:36 +00:00