/** * @covers \Magento\Theme\Model\Config\Customization::getAssignedThemeCustomizations * @covers \Magento\Theme\Model\Config\Customization::hasThemeAssigned */ public function testGetAssignedThemeCustomizations() { $this->designPackage->expects($this->once())->method('getConfigurationDesignTheme')->willReturn($this->getAssignedTheme()->getId()); $this->storeManager->expects($this->once())->method('getStores')->willReturn([$this->getStore()]); $this->themeProviderMock->expects($this->once())->method('getThemeCustomizations')->with(Area::AREA_FRONTEND)->willReturn([$this->getAssignedTheme(), $this->getUnassignedTheme()]); $assignedThemes = $this->model->getAssignedThemeCustomizations(); $this->assertArrayHasKey($this->getAssignedTheme()->getId(), $assignedThemes); $this->assertTrue($this->model->hasThemeAssigned()); }
/** * Load layout * * @return void */ protected function _renderStoreDesigner() { try { $this->_view->loadLayout(); $this->_setActiveMenu('Magento_DesignEditor::system_design_editor'); $this->_setTitle(); if (!$this->_isFirstEntrance()) { /** @var $assignedThemeBlock * \Magento\DesignEditor\Block\Adminhtml\Theme\Selector\SelectorList\Assigned */ $assignedThemeBlock = $this->_view->getLayout()->getBlock('assigned.theme.list'); $assignedThemeBlock->setCollection($this->_customizationConfig->getAssignedThemeCustomizations()); /** @var $unassignedThemeBlock * \Magento\DesignEditor\Block\Adminhtml\Theme\Selector\SelectorList\Unassigned */ $unassignedThemeBlock = $this->_view->getLayout()->getBlock('unassigned.theme.list'); $unassignedThemeBlock->setCollection($this->_customizationConfig->getUnassignedThemeCustomizations()); $unassignedThemeBlock->setHasThemeAssigned($this->_customizationConfig->hasThemeAssigned()); } /** @var $storeViewBlock \Magento\DesignEditor\Block\Adminhtml\Theme\Selector\StoreView */ $storeViewBlock = $this->_view->getLayout()->getBlock('theme.selector.storeview'); $storeViewBlock->setData('actionOnAssign', 'refresh'); $this->_view->renderLayout(); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t load the list of themes.')); $this->getResponse()->setRedirect($this->_redirect->getRefererUrl()); $this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e); } }