소스 검색

[Translation] Modified Translation unit test "testTransWithFallbackLocale"

Now the test shows the behavior when is requested a translation to an undefined locale catalogue and, therefore, the fallbacklocale catalogue must be queried. The original test function only checks the step to reach the language catalog not to the fallbacklocale one (even the fallbacklocale isn't set). This test gives error in the current version of symfony/symfony.
Cristian Gonzalez 14 년 전
부모
커밋
db1ea0d2e1
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      tests/Symfony/Tests/Component/Translation/TranslatorTest.php

+ 3 - 1
tests/Symfony/Tests/Component/Translation/TranslatorTest.php

@@ -43,11 +43,13 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
 
     public function testTransWithFallbackLocale()
     {
-        $translator = new Translator('en_US', new MessageSelector());
+        $translator = new Translator('fr_FR', new MessageSelector());
         $translator->addLoader('array', new ArrayLoader());
         $translator->addResource('array', array('foo' => 'foofoo'), 'en_US');
         $translator->addResource('array', array('bar' => 'foobar'), 'en');
 
+        $translator->setFallbackLocale('en');
+
         $this->assertEquals('foobar', $translator->trans('bar'));
     }