You are here

public function TranslatorTest::testTransWithFallbackLocaleTer in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/translation/Tests/TranslatorTest.php \Symfony\Component\Translation\Tests\TranslatorTest::testTransWithFallbackLocaleTer()

File

vendor/symfony/translation/Tests/TranslatorTest.php, line 244

Class

TranslatorTest

Namespace

Symfony\Component\Translation\Tests

Code

public function testTransWithFallbackLocaleTer() {
  $translator = new Translator('fr_FR');
  $translator
    ->addLoader('array', new ArrayLoader());
  $translator
    ->addResource('array', array(
    'foo' => 'foo (en_US)',
  ), 'en_US');
  $translator
    ->addResource('array', array(
    'bar' => 'bar (en)',
  ), 'en');
  $translator
    ->setFallbackLocales(array(
    'en_US',
    'en',
  ));
  $this
    ->assertEquals('foo (en_US)', $translator
    ->trans('foo'));
  $this
    ->assertEquals('bar (en)', $translator
    ->trans('bar'));
}