public function TranslatorTest::testGetMessages in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/translation/Tests/TranslatorTest.php \Symfony\Component\Translation\Tests\TranslatorTest::testGetMessages()
@dataProvider dataProviderGetMessages
File
- vendor/
symfony/ translation/ Tests/ TranslatorTest.php, line 502
Class
Namespace
Symfony\Component\Translation\TestsCode
public function testGetMessages($resources, $locale, $expected) {
$locales = array_keys($resources);
$_locale = null !== $locale ? $locale : reset($locales);
$locales = array_slice($locales, 0, array_search($_locale, $locales));
$translator = new Translator($_locale, new MessageSelector());
$translator
->setFallbackLocales(array_reverse($locales));
$translator
->addLoader('array', new ArrayLoader());
foreach ($resources as $_locale => $domainMessages) {
foreach ($domainMessages as $domain => $messages) {
$translator
->addResource('array', $messages, $_locale, $domain);
}
}
$result = $translator
->getMessages($locale);
$this
->assertEquals($expected, $result);
}