You are here

protected function PluralizationRulesTest::validateMatrix in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/translation/Tests/PluralizationRulesTest.php \Symfony\Component\Translation\Tests\PluralizationRulesTest::validateMatrix()

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

Parameters

string $nplural plural expected:

array $matrix containing langcodes and their plural index values.:

bool $expectSuccess:

2 calls to PluralizationRulesTest::validateMatrix()
PluralizationRulesTest::testFailedLangcodes in vendor/symfony/translation/Tests/PluralizationRulesTest.php
We test failed langcode here.
PluralizationRulesTest::testLangcodes in vendor/symfony/translation/Tests/PluralizationRulesTest.php
@dataProvider successLangcodes

File

vendor/symfony/translation/Tests/PluralizationRulesTest.php, line 99

Class

PluralizationRulesTest
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.

Namespace

Symfony\Component\Translation\Tests

Code

protected function validateMatrix($nplural, $matrix, $expectSuccess = true) {
  foreach ($matrix as $langCode => $data) {
    $indexes = array_flip($data);
    if ($expectSuccess) {
      $this
        ->assertEquals($nplural, count($indexes), "Langcode '{$langCode}' has '{$nplural}' plural forms.");
    }
    else {
      $this
        ->assertNotEquals((int) $nplural, count($indexes), "Langcode '{$langCode}' has '{$nplural}' plural forms.");
    }
  }
}