/** * Get filter object for template processing * * @return \Magento\Email\Model\Template\Filter */ public function getTemplateFilter() { if (empty($this->templateFilter)) { $this->templateFilter = $this->getFilterFactory()->create(); $this->templateFilter->setUseAbsoluteLinks($this->getUseAbsoluteLinks())->setStoreId($this->getDesignConfig()->getStore())->setUrlModel($this->urlModel); } return $this->templateFilter; }
/** * @magentoDataFixture Magento/Email/Model/_files/themes.php * @magentoAppIsolation enabled * @dataProvider layoutDirectiveDataProvider * * @param string $area * @param string $directiveParams * @param string $expectedOutput */ public function testLayoutDirective($area, $directiveParams, $expectedOutput) { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array(\Magento\Framework\App\Filesystem::PARAM_APP_DIRS => array(\Magento\Framework\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/_files/design')))); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Email\\Model\\Template\\Filter'); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $themes = array('frontend' => 'test_default', 'adminhtml' => 'test_default'); $design = $objectManager->create('Magento\\Core\\Model\\View\\Design', array('themes' => $themes)); $objectManager->addSharedInstance($design, 'Magento\\Core\\Model\\View\\Design'); \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); $collection = $objectManager->create('Magento\\Core\\Model\\Resource\\Theme\\Collection'); $themeId = $collection->getThemeByFullPath('frontend/test_default')->getId(); $objectManager->get('Magento\\Framework\\App\\Config\\MutableScopeConfigInterface')->setValue(\Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID, $themeId, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); /** @var $layout \Magento\Framework\View\LayoutInterface */ $layout = $objectManager->create('Magento\\Framework\\View\\Layout'); $objectManager->addSharedInstance($layout, 'Magento\\Framework\\View\\Layout'); $objectManager->get('Magento\\Framework\\View\\DesignInterface')->setDesignTheme('test_default'); $actualOutput = $this->_model->layoutDirective(array('{{layout ' . $directiveParams . '}}', 'layout', ' ' . $directiveParams)); $this->assertEquals($expectedOutput, trim($actualOutput)); }
/** * Setup the design params */ protected function setUpDesignParams() { $themeCode = 'Vendor/custom_theme'; $this->_model->setDesignParams(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'theme' => $themeCode, 'locale' => \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE]); }
/** * Setup the design params */ protected function setUpDesignParams() { $themeCode = 'Vendor_EmailTest/custom_theme'; $this->model->setDesignParams(['area' => Area::AREA_FRONTEND, 'theme' => $themeCode, 'locale' => Locale::DEFAULT_SYSTEM_LOCALE]); }