Example #1
0
 /**
  * @covers \Magento\Email\Block\Adminhtml\Template\Edit\Form::getVariables
  */
 public function testGetVariables()
 {
     $this->variablesMock->expects($this->once())->method('toOptionArray')->willReturn(['var1', 'var2', 'var3']);
     $this->variableFactoryMock->expects($this->once())->method('create')->willReturn($this->variableMock);
     $this->variableMock->expects($this->once())->method('getVariablesOptionArray')->willReturn(['custom var 1', 'custom var 2']);
     $this->registryMock->expects($this->once())->method('registry')->willReturn($this->templateMock);
     $this->templateMock->expects($this->once())->method('getId')->willReturn(1);
     $this->templateMock->expects($this->once())->method('getVariablesOptionArray')->willReturn(['template var 1', 'template var 2']);
     $this->assertEquals([['var1', 'var2', 'var3'], ['custom var 1', 'custom var 2'], ['template var 1', 'template var 2']], $this->form->getVariables());
 }
 public function testSetOptions()
 {
     $this->mockModel();
     $options = ['area' => 'test area', 'store' => 1];
     $this->model->setOptions($options);
     $this->assertEquals($options, $this->model->getDesignConfig()->getData());
 }
Example #3
0
 /**
  * Check usage of template code in other templates
  *
  * @param \Magento\Email\Model\Template $template
  * @return bool
  */
 public function checkCodeUsage(\Magento\Email\Model\Template $template)
 {
     if ($template->getTemplateActual() != 0 || is_null($template->getTemplateActual())) {
         $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), 'COUNT(*)')->where('template_code = :template_code');
         $bind = array('template_code' => $template->getTemplateCode());
         $templateId = $template->getId();
         if ($templateId) {
             $select->where('template_id != :template_id');
             $bind['template_id'] = $templateId;
         }
         $result = $this->_getReadAdapter()->fetchOne($select, $bind);
         if ($result) {
             return true;
         }
     }
     return false;
 }
 /**
  * @magentoAppIsolation enabled
  */
 public function testGetDefaultEmailLogo()
 {
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\AreaList')->getArea(\Magento\Framework\App\Area::AREA_FRONTEND)->load();
     $this->assertStringEndsWith('static/frontend/Magento/blank/en_US/Magento_Email/logo_email.gif', $this->_model->getDefaultEmailLogo());
 }
Example #5
0
 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\View\DesignInterface $design
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Store\Model\App\Emulation $appEmulation
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Framework\Filesystem $filesystem
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  * @param \Magento\Framework\View\FileSystem $viewFileSystem
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\Email\Model\Template\FilterFactory $emailFilterFactory
  * @param \Magento\Email\Model\Template\Config $emailConfig
  * @param \Magento\Config\Model\Config\Structure $structure
  * @param array $data
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Registry $registry, \Magento\Store\Model\App\Emulation $appEmulation, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\View\FileSystem $viewFileSystem, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Email\Model\Template\FilterFactory $emailFilterFactory, \Magento\Email\Model\Template\Config $emailConfig, \Magento\Config\Model\Config\Structure $structure, array $data = [])
 {
     parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $filesystem, $assetRepo, $viewFileSystem, $scopeConfig, $emailFilterFactory, $emailConfig, $data);
     $this->_structure = $structure;
 }