Created
September 28, 2016 12:08
-
-
Save inri13666/0a9cfd875dbf5379eb5f4bfd4ce41916 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function testRebuildCache() | |
{ | |
$translator = $this->getContainer()->get('translator.default'); | |
$key = uniqid('TRANSLATION_KEY_', true); | |
$domain = LoadTranslations::TRANSLATION_KEY_DOMAIN; | |
$locale = LoadLanguages::LANGUAGE2; | |
$expectedValue = uniqid('TEST_VALUE_', true) . ''; | |
$this->manager->saveValue($key, $expectedValue, $locale, $domain); | |
$this->manager->flush(); | |
//Ensure that catalog still contains old translated value | |
$actualValue = $translator->trans($key, [], $domain, $locale); | |
$this->assertNotEquals($expectedValue, $actualValue); | |
$this->manager->rebuildCache(); | |
//Ensure that catalog now contains new translated value | |
$actualValue = $translator->trans($key, [], $domain, $locale); | |
$this->assertEquals((string)$expectedValue, (string)$actualValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment