Ejemplo n.º 1
0
 /**
  * Load/Reload Website collection
  *
  * @return $this
  */
 protected function _loadWebsiteCollection()
 {
     switch ($this->scopeDefiner->getScope()) {
         case ScopeConfigInterface::SCOPE_TYPE_DEFAULT:
             $this->_websiteCollection = $this->_storeManager->getWebsites();
             break;
         case StoreScopeInterface::SCOPE_WEBSITE:
             $websites = $this->_storeManager->getWebsites();
             $websiteId = $this->scopeDefiner->getScopeValue();
             $this->_websiteCollection = isset($websites[$websiteId]) ? [$websites[$websiteId]] : [];
             break;
         case StoreScopeInterface::SCOPE_STORE:
         default:
             $this->_websiteCollection = [];
             break;
     }
     return $this;
 }
 public function testGetFrontendWebsiteOrBackendValueBackendStoreScope()
 {
     $path = 'test-path';
     $this->appStateHelper->expects($this->once())->method('isFrontendArea')->willReturn(false);
     $this->scopeDefiner->expects($this->atLeastOnce())->method('getScope')->willReturn(ScopeInterface::SCOPE_STORE);
     $this->scopeDefiner->expects($this->never())->method('getScopeValue');
     $this->appScopeConfig->expects($this->never())->method('getValue');
     $this->assertEmpty($this->scopeConfig->getFrontendWebsiteOrBackendValue($path));
 }
 /**
  * @param string $path
  * @return string
  */
 public function getFrontendWebsiteOrBackendValue($path)
 {
     $value = '';
     if ($this->appStateHelper->isFrontendArea()) {
         $value = $this->getWebsiteValue($path);
     } else {
         if ($this->scopeDefiner->getScope() != ScopeInterface::SCOPE_STORE) {
             $value = $this->appScopeConfig->getValue($path, $this->scopeDefiner->getScope(), $this->scopeDefiner->getScopeValue());
         }
     }
     return $value;
 }
 public function testGetScopeValueWebsite()
 {
     $websiteValue = 'website-value';
     $this->request->expects($this->any())->method('getParam')->willReturnMap([['store', null, null], ['website', null, $websiteValue], ['website', null, $websiteValue]]);
     $this->assertEquals($websiteValue, $this->scopeDefiner->getScopeValue());
 }