public function testGetConfigDataWithSecureIsForcedParam() { $model = $this->getUrlModel([ 'routeParamsResolverFactory' => $this->getRouteParamsResolverFactory(), 'scopeResolver' => $this->scopeResolverMock, 'scopeConfig' => $this->scopeConfig, ]); $this->scopeConfig->expects($this->any()) ->method('getValue') ->with( 'web/secure/base_url_secure_forced', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->scopeMock ) ->will($this->returnValue('http://localhost/')); $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') ->will($this->returnValue(true)); $this->routeParamsResolverMock->expects($this->once())->method('getData')->with('secure') ->will($this->returnValue(true)); $this->scopeResolverMock->expects($this->any()) ->method('getScope') ->will($this->returnValue($this->scopeMock)); $this->assertEquals('http://localhost/', $model->getConfigData('base_url_secure_forced')); }
/** * Process scope query parameters. * * @param \Magento\Framework\Url\RouteParamsResolver $subject * @param callable $proceed * @param array $data * @param bool $unsetOldParams * @return \Magento\Framework\Url\RouteParamsResolver * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundSetRouteParams(\Magento\Framework\Url\RouteParamsResolver $subject, \Closure $proceed, array $data, $unsetOldParams = true) { if (isset($data['_scope'])) { $subject->setScope($data['_scope']); unset($data['_scope']); } if (isset($data['_scope_to_url']) && (bool) $data['_scope_to_url'] === true) { $storeCode = $subject->getScope() ?: $this->storeManager->getStore()->getCode(); $useStoreInUrl = $this->scopeConfig->getValue(Store::XML_PATH_STORE_IN_URL, StoreScopeInterface::SCOPE_STORE, $storeCode); if (!$useStoreInUrl && !$this->storeManager->hasSingleStore()) { $this->queryParamsResolver->setQueryParam('___store', $storeCode); } } unset($data['_scope_to_url']); return $proceed($data, $unsetOldParams); }
/** * {@inheritdoc} */ public function setRouteParams(array $data, $unsetOldParams = true) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setRouteParams'); if (!$pluginInfo) { return parent::setRouteParams($data, $unsetOldParams); } else { return $this->___callPlugins('setRouteParams', func_get_args(), $pluginInfo); } }
/** * {@inheritdoc} */ public function offsetGet($offset) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'offsetGet'); if (!$pluginInfo) { return parent::offsetGet($offset); } else { return $this->___callPlugins('offsetGet', func_get_args(), $pluginInfo); } }