public function testEmulateDesignAndRevertDesign() { $originalConfig = ['area' => 'some_area', 'store' => 1]; $expectedConfig = ['area' => 'frontend', 'store' => 2]; $this->_model->setDesignConfig($originalConfig); $this->_model->emulateDesign(2); // assert config data has been emulated $this->assertEquals($expectedConfig, $this->_model->getDesignConfig()->getData()); $this->_model->revertDesign(); // assert config data has been reverted to the original state $this->assertEquals($originalConfig, $this->_model->getDesignConfig()->getData()); }
/** * Processing object before save data * * @return $this */ public function beforeSave() { $this->validate(); return parent::beforeSave(); }
/** * Initialize resource model * * @return void */ protected function _construct() { parent::_construct(); $this->_init('Magento\\Newsletter\\Model\\Resource\\Queue'); }
/** * Validate email template code * * @throws \Magento\Framework\Mail\Exception * @return $this */ protected function _beforeSave() { $code = $this->getTemplateCode(); if (empty($code)) { throw new \Magento\Framework\Mail\Exception(__('The template Name must not be empty.')); } if ($this->_getResource()->checkCodeUsage($this)) { throw new \Magento\Framework\Mail\Exception(__('Duplicate Of Template Name')); } return parent::_beforeSave(); }
/** * Processing object before save data * * @return $this */ protected function _beforeSave() { $this->validate(); return parent::_beforeSave(); }
/** * Validate email template code * * @throws \Magento\Framework\Exception\MailException * @return $this */ public function beforeSave() { $code = $this->getTemplateCode(); if (empty($code)) { throw new \Magento\Framework\Exception\MailException(__('Please enter a template name.')); } if ($this->_getResource()->checkCodeUsage($this)) { throw new \Magento\Framework\Exception\MailException(__('Duplicate Of Template Name')); } return parent::beforeSave(); }
/** * @param AbstractTemplate $template * @return void */ protected function setTemplateFilter(AbstractTemplate $template) { if (isset($this->templateData['template_filter'])) { $template->setTemplateFilter($this->templateData['template_filter']); } }