示例#1
0
 /**
  * Gets the locale.
  *
  * @param string $code the locale code, if not specified then the current locale is assumed
  * @return zibo\library\i18n\locale\Locale
  *
  * @throws zibo\library\i18n\exception\LocaleNotFoundException if the locale with the specified code could not be found
  * @throws zibo\ZiboException when $code is not specified and no locales could be found
  */
 public function getLocale($code = null)
 {
     $locale = $this->localeManager->getLocale($code);
     if (!$locale) {
         throw new LocaleNotFoundException($code);
     }
     return $locale;
 }
示例#2
0
 /**
  * @dataProvider providerGetLocaleThrowsInvalidArgumentExceptionIfArgumentIsNotAString
  * @expectedException \InvalidArgumentException
  */
 public function testGetLocaleThrowsInvalidArgumentExceptionIfArgumentIsNotAString($arg)
 {
     $this->configIOMock->setValues('i18n', array('locale' => array('io' => 'zibo\\library\\i18n\\locale\\io\\IOMock', 'order' => '')));
     Zibo::getInstance($this->browser, $this->configIOMock);
     $manager = new Manager();
     $locale = $manager->getLocale($arg);
 }