/** * 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; }
/** * @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); }