/** * {@inheritdoc} */ public function getLocaleNames($locale = null) { if (null === $locale) { $locale = \Locale::getDefault(); } $locales = parent::getLocaleNames($locale); $collator = new \Collator($locale); $collator->asort($locales); return $locales; }
public function testGetLocaleNames() { $sortedLocales = array('en_IE' => 'English (Ireland)', 'en_GB' => 'English (United Kingdom)', 'en_US' => 'English (United States)'); $this->reader->expects($this->once())->method('readEntry')->with(self::RES_DIR, 'en', array('Locales'))->will($this->returnValue($sortedLocales)); $this->assertSame($sortedLocales, $this->bundle->getLocaleNames('en')); }