示例#1
0
 /**
  * @magentoAppIsolation enabled
  * @magentoDataFixture Magento/Store/_files/core_fixturestore.php
  */
 public function testGetProcessedTemplate()
 {
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\AreaList')->getArea(\Magento\Framework\App\Area::AREA_FRONTEND)->load();
     $this->_setNotDefaultThemeForFixtureStore();
     $expectedViewUrl = 'static/frontend/Magento/luma/en_US/Magento_Theme/favicon.ico';
     $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}');
     $this->assertStringEndsNotWith($expectedViewUrl, $this->_model->getProcessedTemplate());
     $this->_model->setDesignConfig(['area' => 'frontend', 'store' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Store\\Model\\StoreManagerInterface')->getStore('fixturestore')->getId()]);
     $this->assertStringEndsWith($expectedViewUrl, $this->_model->getProcessedTemplate());
 }
示例#2
0
 /**
  * Test template directive to ensure that templates can be loaded from modules, overridden in backend, and
  * overridden in themes
  *
  * @magentoDataFixture Magento/Store/_files/core_fixturestore.php
  * @magentoDataFixture Magento/Email/Model/_files/design/themes.php
  * @magentoAppIsolation enabled
  * @dataProvider templateDirectiveDataProvider
  *
  * @param $area
  * @param $templateText
  * @param $expectedOutput
  * @param $storeConfigPath
  */
 public function testTemplateDirective($area, $templateText, $expectedOutput, $storeConfigPath = null)
 {
     $filesystem = $this->_getMockedFilesystem();
     $this->_mockModel($filesystem);
     $this->setUpThemeFallback($area);
     $this->_model->setTemplateText($templateText);
     // Allows for testing of templates overridden in backend
     if ($storeConfigPath) {
         $template = $this->_objectManager->create('Magento\\Email\\Model\\Template');
         $templateData = ['template_code' => 'some_unique_code', 'template_type' => \Magento\Email\Model\Template::TYPE_HTML, 'template_text' => $expectedOutput];
         $template->setData($templateData);
         $template->save();
         $templateId = $template->getId();
         // Store the ID of the newly created template in the system config so that this template will be loaded
         $this->_objectManager->get('Magento\\Framework\\App\\Config\\MutableScopeConfigInterface')->setValue($storeConfigPath, $templateId, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, 'fixturestore');
     }
     $this->assertContains($expectedOutput, $this->_model->getProcessedTemplate());
 }
示例#3
0
 /**
  * Test template directive to ensure that templates can be loaded from modules, overridden in backend, and
  * overridden in themes
  *
  * @magentoDataFixture Magento/Store/_files/core_fixturestore.php
  * @magentoComponentsDir Magento/Email/Model/_files/design
  * @magentoAppIsolation enabled
  * @magentoDbIsolation enabled
  * @dataProvider templateDirectiveDataProvider
  *
  * @param string $area
  * @param int $templateType
  * @param string $templateText
  * @param string $assertContains
  * @param string $assertNotContains
  * @param string $storeConfigPath
  * @param bool $mockAdminTheme
  */
 public function testTemplateDirective($area, $templateType, $templateText, $assertContains, $assertNotContains = null, $storeConfigPath = null, $mockAdminTheme = false)
 {
     $this->mockModel();
     if ($mockAdminTheme) {
         $this->setUpAdminThemeFallback();
     } else {
         $this->setUpThemeFallback($area);
     }
     $this->model->setTemplateType($templateType);
     $this->model->setTemplateText($templateText);
     // Allows for testing of templates overridden in backend
     if ($storeConfigPath) {
         $template = $this->objectManager->create('Magento\\Email\\Model\\Template');
         $templateData = ['template_code' => 'some_unique_code', 'template_type' => $templateType, 'template_text' => $assertContains];
         $template->setData($templateData);
         $template->save();
         // Store the ID of the newly created template in the system config so that this template will be loaded
         $this->objectManager->get('Magento\\Framework\\App\\Config\\MutableScopeConfigInterface')->setValue($storeConfigPath, $template->getId(), ScopeInterface::SCOPE_STORE, 'fixturestore');
     }
     $this->assertContains($assertContains, $this->model->getProcessedTemplate());
     if ($assertNotContains) {
         $this->assertNotContains($assertNotContains, $this->model->getProcessedTemplate());
     }
 }
 /**
  * @magentoAppIsolation enabled
  * @magentoDataFixture Magento/Core/_files/design_change.php
  */
 public function testGetProcessedTemplateDesignChange()
 {
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\AreaList')->getArea(\Magento\Framework\App\Area::AREA_FRONTEND)->load();
     $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}');
     $this->assertStringEndsWith('static/frontend/Magento/plushe/en_US/Magento_Theme/favicon.ico', $this->_model->getProcessedTemplate());
 }
示例#5
0
 /**
  * @magentoAppIsolation enabled
  * @magentoDataFixture Mage/Core/_files/design_change.php
  */
 public function testGetProcessedTemplateDesignChange()
 {
     $this->_model->setTemplateText('{{view url="Mage_Page::favicon.ico"}}');
     $this->assertStringEndsWith('theme/frontend/default/modern/en_US/Mage_Page/favicon.ico', $this->_model->getProcessedTemplate());
 }