/** * Set locale * * @param string $locale * @return $this */ public function setLocale($locale = null) { $forceLocale = $this->_request->getParam('locale', null); if (!$this->_localeValidator->isValid($forceLocale)) { $forceLocale = false; } $sessionLocale = $this->_session->getSessionLocale(); $userLocale = $this->_localeManager->getUserInterfaceLocale(); $localeCodes = array_filter([$forceLocale, $sessionLocale, $userLocale]); if (count($localeCodes)) { $locale = reset($localeCodes); } return parent::setLocale($locale); }
/** * @dataProvider testIsValidDataProvider * @param string $locale * @param boolean $valid * @covers \Magento\Framework\Locale\Validator::isValid */ public function testIsValid($locale, $valid) { $this->assertEquals($valid, $this->_validatorModel->isValid($locale)); }