protected function PluralizationRulesTest::validateMatrix in Plug 7
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 lib/
Symfony/ translation/ Tests/ PluralizationRulesTest.php - We test failed langcode here.
- PluralizationRulesTest::testLangcodes in lib/
Symfony/ translation/ Tests/ PluralizationRulesTest.php - @dataProvider successLangcodes
File
- lib/
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\TestsCode
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.");
}
}
}