public function TranslatorCacheTest::testRefreshCacheWhenResourcesAreNoLongerFresh in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/translation/Tests/TranslatorCacheTest.php \Symfony\Component\Translation\Tests\TranslatorCacheTest::testRefreshCacheWhenResourcesAreNoLongerFresh()
File
- vendor/
symfony/ translation/ Tests/ TranslatorCacheTest.php, line 229
Class
Namespace
Symfony\Component\Translation\TestsCode
public function testRefreshCacheWhenResourcesAreNoLongerFresh() {
$resource = $this
->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface');
$loader = $this
->getMock('Symfony\\Component\\Translation\\Loader\\LoaderInterface');
$resource
->method('isFresh')
->will($this
->returnValue(false));
$loader
->expects($this
->exactly(2))
->method('load')
->will($this
->returnValue($this
->getCatalogue('fr', array(), array(
$resource,
))));
// prime the cache
$translator = new Translator('fr', null, $this->tmpDir, true);
$translator
->addLoader('loader', $loader);
$translator
->addResource('loader', 'foo', 'fr');
$translator
->trans('foo');
// prime the cache second time
$translator = new Translator('fr', null, $this->tmpDir, true);
$translator
->addLoader('loader', $loader);
$translator
->addResource('loader', 'foo', 'fr');
$translator
->trans('foo');
}