public function TranslatorCacheTest::testThatACacheIsUsed in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/translation/Tests/TranslatorCacheTest.php \Symfony\Component\Translation\Tests\TranslatorCacheTest::testThatACacheIsUsed()
@dataProvider runForDebugAndProduction
File
- vendor/
symfony/ translation/ Tests/ TranslatorCacheTest.php, line 58
Class
Namespace
Symfony\Component\Translation\TestsCode
public function testThatACacheIsUsed($debug) {
$locale = 'any_locale';
$format = 'some_format';
$msgid = 'test';
// Prime the cache
$translator = new Translator($locale, null, $this->tmpDir, $debug);
$translator
->addLoader($format, new ArrayLoader());
$translator
->addResource($format, array(
$msgid => 'OK',
), $locale);
$translator
->trans($msgid);
// Try again and see we get a valid result whilst no loader can be used
$translator = new Translator($locale, null, $this->tmpDir, $debug);
$translator
->addLoader($format, $this
->createFailingLoader());
$translator
->addResource($format, array(
$msgid => 'OK',
), $locale);
$this
->assertEquals('OK', $translator
->trans($msgid), '-> caching does not work in ' . ($debug ? 'debug' : 'production'));
}