|
12 | 12 | namespace Symfony\Bundle\FrameworkBundle\Tests\Translation;
|
13 | 13 |
|
14 | 14 | use Symfony\Bundle\FrameworkBundle\Translation\Translator;
|
15 |
| -use Symfony\Component\Translation\Loader\ArrayLoader; |
16 | 15 | use Symfony\Component\Translation\MessageCatalogue;
|
17 | 16 | use Symfony\Component\Filesystem\Filesystem;
|
18 | 17 | use Symfony\Component\Translation\MessageSelector;
|
@@ -105,7 +104,7 @@ public function testTransWithCachingWithInvalidLocale()
|
105 | 104 | $translator->trans('foo');
|
106 | 105 | }
|
107 | 106 |
|
108 |
| - public function testLoadRessourcesWithCaching() |
| 107 | + public function testLoadResourcesWithCaching() |
109 | 108 | {
|
110 | 109 | $loader = new \Symfony\Component\Translation\Loader\YamlFileLoader();
|
111 | 110 | $resourceFiles = array(
|
@@ -133,7 +132,7 @@ public function testLoadRessourcesWithCaching()
|
133 | 132 | $this->assertEquals('folder', $translator->trans('folder'));
|
134 | 133 | }
|
135 | 134 |
|
136 |
| - public function testLoadRessourcesWithoutCaching() |
| 135 | + public function testLoadResourcesWithoutCaching() |
137 | 136 | {
|
138 | 137 | $loader = new \Symfony\Component\Translation\Loader\YamlFileLoader();
|
139 | 138 | $resourceFiles = array(
|
@@ -271,17 +270,20 @@ public function testWarmup()
|
271 | 270 | __DIR__.'/../Fixtures/Resources/translations/messages.fr.yml',
|
272 | 271 | ),
|
273 | 272 | );
|
274 |
| - $catalogueHash = sha1(serialize(array( |
275 |
| - 'resources' => array(), |
276 |
| - 'fallback_locales' => array(), |
277 |
| - ))); |
278 | 273 |
|
279 | 274 | // prime the cache
|
280 | 275 | $translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir, 'resource_files' => $resourceFiles), 'yml');
|
281 |
| - |
282 |
| - $this->assertFalse(file_exists($this->tmpDir.'/catalogue.fr.'.$catalogueHash.'.php')); |
| 276 | + $translator->setLocale('fr'); |
283 | 277 | $translator->warmup($this->tmpDir);
|
284 |
| - $this->assertTrue(file_exists($this->tmpDir.'/catalogue.fr.'.$catalogueHash.'.php')); |
| 278 | + |
| 279 | + $loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface'); |
| 280 | + $loader |
| 281 | + ->expects($this->never()) |
| 282 | + ->method('load'); |
| 283 | + |
| 284 | + $translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir, 'resource_files' => $resourceFiles), 'yml'); |
| 285 | + $translator->setLocale('fr'); |
| 286 | + $this->assertEquals('répertoire', $translator->trans('folder')); |
285 | 287 | }
|
286 | 288 |
|
287 | 289 | private function createTranslator($loader, $options, $translatorClass = '\Symfony\Bundle\FrameworkBundle\Translation\Translator', $loaderFomat = 'loader')
|
|
0 commit comments