/** * Setup the theme fallback structure and set the Vendor/custom_theme as the current theme for 'fixturestore' store * * @param $area */ protected function setUpThemeFallback($area) { $themes = ['frontend' => 'Vendor/custom_theme']; $design = $this->_objectManager->create('Magento\\Theme\\Model\\View\\Design', ['themes' => $themes]); $this->_objectManager->addSharedInstance($design, 'Magento\\Theme\\Model\\View\\Design'); // It is important to test from both areas, as emails will get sent from both, so we need to ensure that the // inline CSS files get loaded properly from both areas. \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); $collection = $this->_objectManager->create('Magento\\Theme\\Model\\Resource\\Theme\\Collection'); // Hard-coding theme as we want to test the fallback structure to ensure that the parent/grandparent themes of // Vendor/custom_theme will be checked for CSS files $themeId = $collection->getThemeByFullPath('frontend/Vendor/custom_theme')->getId(); $this->_objectManager->get('Magento\\Framework\\App\\Config\\MutableScopeConfigInterface')->setValue(\Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID, $themeId, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, 'fixturestore'); $this->_model->setDesignConfig(['area' => 'frontend', 'store' => $this->_objectManager->get('Magento\\Store\\Model\\StoreManagerInterface')->getStore('fixturestore')->getId()]); }
/** * Setup the theme fallback structure and set the Vendor_EmailTest/custom_theme as the current theme for * 'fixturestore' store */ protected function setUpAdminThemeFallback() { $themes = [BackendFrontNameResolver::AREA_CODE => 'Vendor_EmailTest/custom_theme']; $design = $this->objectManager->create('Magento\\Theme\\Model\\View\\Design', ['themes' => $themes]); $this->objectManager->addSharedInstance($design, 'Magento\\Theme\\Model\\View\\Design'); /** @var \Magento\Theme\Model\Theme\Registration $registration */ $registration = $this->objectManager->get('Magento\\Theme\\Model\\Theme\\Registration'); $registration->register(); // The Vendor_EmailTest/custom_theme adminhtml theme is set in the // dev/tests/integration/testsuite/Magento/Email/Model/_files/design/themes.php file, as it must be set // before the adminhtml area is loaded below. Bootstrap::getInstance()->loadArea(BackendFrontNameResolver::AREA_CODE); /** @var \Magento\Store\Model\Store $adminStore */ $adminStore = $this->objectManager->create('Magento\\Store\\Model\\Store')->load(Store::ADMIN_CODE); $this->model->setDesignConfig(['area' => 'adminhtml', 'store' => $adminStore->getId()]); }