Пример #1
0
 protected function setUp()
 {
     $this->_dataStorage = $this->getMock('Magento\\Email\\Model\\Template\\Config\\Data', array('get'), array(), '', false);
     $this->_dataStorage->expects($this->any())->method('get')->will($this->returnValue(require __DIR__ . '/Config/_files/email_templates_merged.php'));
     $this->_moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', array('getModuleDir'), array(), '', false);
     $this->_model = new \Magento\Email\Model\Template\Config($this->_dataStorage, $this->_moduleReader);
 }
Пример #2
0
 protected function setUp()
 {
     $this->_dataStorage = $this->getMock('Magento\\Email\\Model\\Template\\Config\\Data', ['get'], [], '', false);
     $this->_dataStorage->expects($this->any())->method('get')->will($this->returnValue(require __DIR__ . '/Config/_files/email_templates_merged.php'));
     $this->_moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', ['getModuleDir'], [], '', false);
     $this->viewFileSystem = $this->getMock('\\Magento\\Framework\\View\\FileSystem', ['getEmailTemplateFileName'], [], '', false);
     $this->fileSystem = $this->getMock('\\Magento\\Framework\\Filesystem', [], [], '', false);
     $this->_model = $this->getMockBuilder('\\Magento\\Email\\Model\\Template\\Config')->setConstructorArgs([$this->_dataStorage, $this->_moduleReader, $this->fileSystem, $this->viewFileSystem])->setMethods(['getThemeTemplates'])->getMock();
 }
Пример #3
0
 protected function setUp()
 {
     $this->_dataStorage = $this->getMock('Magento\\Email\\Model\\Template\\Config\\Data', ['get'], [], '', false);
     $this->_dataStorage->expects($this->any())->method('get')->will($this->returnValue(require __DIR__ . '/Config/_files/email_templates_merged.php'));
     $this->_moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', ['getModuleDir'], [], '', false);
     $this->viewFileSystem = $this->getMock('\\Magento\\Framework\\View\\FileSystem', ['getEmailTemplateFileName'], [], '', false);
     $this->themePackages = $this->getMock('\\Magento\\Framework\\View\\Design\\Theme\\ThemePackageList', [], [], '', false);
     $this->readDirFactory = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\ReadFactory', [], [], '', false);
     $this->model = new Config($this->_dataStorage, $this->_moduleReader, $this->viewFileSystem, $this->themePackages, $this->readDirFactory);
 }
Пример #4
0
 /**
  * Retrieve value of a field of an email template
  *
  * @param string $templateId Name of an email template
  * @param string $fieldName Name of a field value of which to return
  * @return string
  * @throws \UnexpectedValueException
  */
 protected function _getInfo($templateId, $fieldName)
 {
     $data = $this->_dataStorage->get();
     if (!isset($data[$templateId])) {
         throw new \UnexpectedValueException("Email template '{$templateId}' is not defined.");
     }
     if (!isset($data[$templateId][$fieldName])) {
         throw new \UnexpectedValueException("Field '{$fieldName}' is not defined for email template '{$templateId}'.");
     }
     return $data[$templateId][$fieldName];
 }