Skip to content

Commit 90af960

Browse files
Merge branch '3.2'
* 3.2: move provider after test update dataProvider function name cast substr result to string and remove empty function use rename dataset provider Add a test to prevent future regressions Switch to `empty` native function to check emptiness remove non relevant test case Switch to `is_string` native method Remove unnecessary parentheses Add a test case to prevent future regressions Move empty condition in return statement Use LF line separator fix coding standard to comply with fabbot Remove malformed EmailValidatorTest + Update UrlValidator test Add empty check on host in other methods + add unit tests [Validator] Allow checkMX() to return false when $host is empty [DI] Prevent AutowirePass from triggering irrelevant deprecations [DI] Fix the xml schema [Translation] avoid creating cache files for fallback locales.
2 parents fc74a95 + 713e77a commit 90af960

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Tests/TranslatorCacheTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,17 @@ public function testDifferentTranslatorsForSameLocaleDoNotOverwriteEachOthersCac
149149
$this->assertEquals('OK', $translator->trans($msgid), '-> the cache was overwritten by another translator instance in '.($debug ? 'debug' : 'production'));
150150
}
151151

152+
public function testGeneratedCacheFilesAreOnlyBelongRequestedLocales()
153+
{
154+
$translator = new Translator('a', null, $this->tmpDir);
155+
$translator->setFallbackLocales(array('b'));
156+
$translator->trans('bar');
157+
158+
$cachedFiles = glob($this->tmpDir.'/*.php');
159+
160+
$this->assertCount(1, $cachedFiles);
161+
}
162+
152163
public function testDifferentCacheFilesAreUsedForDifferentSetsOfFallbackLocales()
153164
{
154165
/*

Translator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ private function loadFallbackCatalogues($locale)
386386

387387
foreach ($this->computeFallbackLocales($locale) as $fallback) {
388388
if (!isset($this->catalogues[$fallback])) {
389-
$this->loadCatalogue($fallback);
389+
$this->initializeCatalogue($fallback);
390390
}
391391

392392
$fallbackCatalogue = new MessageCatalogue($fallback, $this->catalogues[$fallback]->all());

0 commit comments

Comments
 (0)