예제 #1
0
 /**
  * Assign Theme
  *
  * @return void
  */
 protected function assignTheme()
 {
     $themes = $this->collectionFactory->create()->loadRegisteredThemes();
     /** @var \Magento\Theme\Model\Theme $theme */
     foreach ($themes as $theme) {
         if ($theme->getCode() == 'Magento/luma') {
             $this->config->assignToStore($theme, [Store::DEFAULT_STORE_ID], ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
         }
     }
 }
예제 #2
0
 /**
  * cover \Magento\Theme\Model\Config::assignToStore
  */
 public function testAssignToStoreNonSingleStoreMode()
 {
     $this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(false));
     $themePath = 'Magento/blank';
     /** Unassign themes from store */
     $configEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope_id' => 8]);
     $this->_configData->expects($this->once())->method('getCollection')->will($this->returnValue($this->_configData));
     $this->_configData->expects($this->at(1))->method('addFieldToFilter')->with('scope', \Magento\Store\Model\ScopeInterface::SCOPE_STORES)->will($this->returnValue($this->_configData));
     $this->_configData->expects($this->at(2))->method('addFieldToFilter')->with('path', \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID)->will($this->returnValue([$configEntity]));
     $this->_themeMock->expects($this->any())->method('getId')->will($this->returnValue(6));
     $this->_themeMock->expects($this->any())->method('getThemePath')->will($this->returnValue($themePath));
     $this->_scopeConfigWriter->expects($this->once())->method('delete');
     $this->_scopeConfigWriter->expects($this->exactly(3))->method('save');
     $this->_model->assignToStore($this->_themeMock, [2, 3, 5]);
 }