function TranslatorTest::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:
2 calls to TranslatorTest::validateMatrix()
- TranslatorTest::testFailedLangcodes in vendor/
symfony/ translation-contracts/ Test/ TranslatorTest.php - @dataProvider failingLangcodes
- TranslatorTest::testLangcodes in vendor/
symfony/ translation-contracts/ Test/ TranslatorTest.php - @dataProvider successLangcodes
File
-
vendor/
symfony/ translation-contracts/ Test/ TranslatorTest.php, line 355
Class
- TranslatorTest
- 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\Contracts\Translation\TestCode
protected function validateMatrix(string $nplural, array $matrix, bool $expectSuccess = true) {
foreach ($matrix as $langCode => $data) {
$indexes = array_flip($data);
if ($expectSuccess) {
$this->assertCount($nplural, $indexes, "Langcode '{$langCode}' has '{$nplural}' plural forms.");
}
else {
$this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '{$langCode}' has '{$nplural}' plural forms.");
}
}
}