Documentation

PluralizationRulesTest extends TestCase
in package

Test should cover all languages mentioned on http://translate.sourceforge.net/wiki/l10n/pluralforms and Plural forms mentioned on http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms.

See also https://developer.mozilla.org/en/Localization_and_Plurals which mentions 15 rules having a maximum of 6 forms. The mozilla code is also interesting to check for.

As mentioned by chx http://drupal.org/node/1273968 we can cover all by testing number from 0 to 199

The goal to cover all languages is to far fetched so this test case is smaller.

Tags
author

Clemens Tolboom clemens@build2be.nl

Table of Contents

failingLangcodes()  : array<string|int, mixed>
This array should be at least empty within the near future.
successLangcodes()  : array<string|int, mixed>
This array should contain all currently known langcodes.
testFailedLangcodes()  : mixed
We test failed langcode here.
testLangcodes()  : mixed
generateTestData()  : mixed
validateMatrix()  : mixed
We validate only on the plural coverage. Thus the real rules is not tested.

Methods

failingLangcodes()

This array should be at least empty within the near future.

public failingLangcodes() : array<string|int, mixed>

This both depends on a complete list trying to add above as understanding the plural rules of the current failing languages.

Return values
array<string|int, mixed>

with nplural together with langcodes

successLangcodes()

This array should contain all currently known langcodes.

public successLangcodes() : array<string|int, mixed>

As it is impossible to have this ever complete we should try as hard as possible to have it almost complete.

Return values
array<string|int, mixed>

testFailedLangcodes()

We test failed langcode here.

public testFailedLangcodes(mixed $nplural, mixed $langCodes) : mixed

TODO: The languages mentioned in the data provide need to get fixed somehow within PluralizationRules.

Parameters
$nplural : mixed
$langCodes : mixed
Tags
dataProvider

failingLangcodes

Return values
mixed

testLangcodes()

public testLangcodes(mixed $nplural, mixed $langCodes) : mixed
Parameters
$nplural : mixed
$langCodes : mixed
Tags
dataProvider

successLangcodes

Return values
mixed

generateTestData()

protected generateTestData(mixed $langCodes) : mixed
Parameters
$langCodes : mixed
Return values
mixed

validateMatrix()

We validate only on the plural coverage. Thus the real rules is not tested.

protected validateMatrix(string $nplural, array<string|int, mixed> $matrix[, bool $expectSuccess = true ]) : mixed
Parameters
$nplural : string

Plural expected

$matrix : array<string|int, mixed>

Containing langcodes and their plural index values

$expectSuccess : bool = true
Return values
mixed

Search results