Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bugfix][Locale] Fixed incomplete Locale data loading
Sublocales like de_CH returned only incomplete results for getDisplayCountries(), getDisplayLanguages() and getDisplayLocales(), consisting only of results specific for this sublocale, but without the results of their respective parent locale
- Loading branch information
1 parent
33f68fe
commit cacc880
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Tests\Component\Locale; | ||
|
||
use Symfony\Component\Locale\Locale; | ||
|
||
class LocaleTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testGetDisplayCountriesReturnsFullListForSubLocale() | ||
{ | ||
$countriesDe = Locale::getDisplayCountries('de'); | ||
$countriesDeCh = Locale::getDisplayCountries('de_CH'); | ||
|
||
$this->assertEquals(count($countriesDe), count($countriesDeCh)); | ||
$this->assertEquals($countriesDe['BD'], 'Bangladesch'); | ||
$this->assertEquals($countriesDeCh['BD'], 'Bangladesh'); | ||
} | ||
|
||
public function testGetDisplayLanguagesReturnsFullListForSubLocale() | ||
{ | ||
$languagesDe = Locale::getDisplayLanguages('de'); | ||
$languagesDeCh = Locale::getDisplayLanguages('de_CH'); | ||
|
||
$this->assertEquals(count($languagesDe), count($languagesDeCh)); | ||
$this->assertEquals($languagesDe['be'], 'Weißrussisch'); | ||
$this->assertEquals($languagesDeCh['be'], 'Weissrussisch'); | ||
} | ||
|
||
public function testGetDisplayLocalesReturnsFullListForSubLocale() | ||
{ | ||
$localesDe = Locale::getDisplayLocales('de'); | ||
$localesDeCh = Locale::getDisplayLocales('de_CH'); | ||
|
||
$this->assertEquals(count($localesDe), count($localesDeCh)); | ||
$this->assertEquals($localesDe['be'], 'Weißrussisch'); | ||
$this->assertEquals($localesDeCh['be'], 'Weissrussisch'); | ||
} | ||
} |