FileAccess Orion

TranslatorTest 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.
getChooseTests()  : mixed
getInternal()  : mixed
getNonMatchingMessages()  : mixed
getTransChoiceTests()  : mixed
getTranslator()  : mixed
getTransTests()  : mixed
successLangcodes()  : array<string|int, mixed>
This array should contain all currently known langcodes.
testChoose()  : mixed
testFailedLangcodes()  : mixed
testGetLocaleReturnsDefaultLocaleIfNotSet()  : mixed
testGetSetLocale()  : mixed
testInterval()  : mixed
testLangcodes()  : mixed
testReturnMessageIfExactlyOneStandardRuleIsGiven()  : mixed
testThrowExceptionIfMatchingMessageCannotBeFound()  : mixed
testTrans()  : mixed
testTransChoiceWithDefaultLocale()  : mixed
testTransChoiceWithExplicitLocale()  : 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

getChooseTests()

public getChooseTests() : mixed
Return values
mixed

getInternal()

public getInternal() : mixed
Return values
mixed

getNonMatchingMessages()

public getNonMatchingMessages() : mixed
Return values
mixed

getTransChoiceTests()

public getTransChoiceTests() : mixed
Return values
mixed

getTranslator()

public getTranslator() : mixed
Return values
mixed

getTransTests()

public getTransTests() : mixed
Return values
mixed

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>

testChoose()

public testChoose(mixed $expected, mixed $id, mixed $number) : mixed
Parameters
$expected : mixed
$id : mixed
$number : mixed
Tags
dataProvider

getChooseTests

Return values
mixed

testFailedLangcodes()

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

failingLangcodes

Return values
mixed

testGetLocaleReturnsDefaultLocaleIfNotSet()

public testGetLocaleReturnsDefaultLocaleIfNotSet() : mixed
Tags
requires

extension intl

Return values
mixed

testGetSetLocale()

public testGetSetLocale() : mixed
Return values
mixed

testInterval()

public testInterval(mixed $expected, mixed $number, mixed $interval) : mixed
Parameters
$expected : mixed
$number : mixed
$interval : mixed
Tags
dataProvider

getInternal

Return values
mixed

testLangcodes()

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

successLangcodes

Return values
mixed

testReturnMessageIfExactlyOneStandardRuleIsGiven()

public testReturnMessageIfExactlyOneStandardRuleIsGiven() : mixed
Return values
mixed

testThrowExceptionIfMatchingMessageCannotBeFound()

public testThrowExceptionIfMatchingMessageCannotBeFound(mixed $id, mixed $number) : mixed
Parameters
$id : mixed
$number : mixed
Tags
dataProvider

getNonMatchingMessages

Return values
mixed

testTrans()

public testTrans(mixed $expected, mixed $id, mixed $parameters) : mixed
Parameters
$expected : mixed
$id : mixed
$parameters : mixed
Tags
dataProvider

getTransTests

Return values
mixed

testTransChoiceWithDefaultLocale()

public testTransChoiceWithDefaultLocale(mixed $expected, mixed $id, mixed $number) : mixed
Parameters
$expected : mixed
$id : mixed
$number : mixed
Tags
dataProvider

getTransChoiceTests

Return values
mixed

testTransChoiceWithExplicitLocale()

public testTransChoiceWithExplicitLocale(mixed $expected, mixed $id, mixed $number) : mixed
Parameters
$expected : mixed
$id : mixed
$number : mixed
Tags
dataProvider

getTransChoiceTests

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