protected function setUp()
 {
     $this->_mail = $this->getMock('Zend_Mail', array('send', 'addTo', 'addBcc', 'setReturnPath', 'setReplyTo'), array('utf-8'));
     $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $this->_model = $this->getMockBuilder('Magento\\Email\\Model\\Template')->setMethods(array('_getMail'))->setConstructorArgs(array($objectManager->get('Magento\\Framework\\Model\\Context'), $objectManager->get('Magento\\Framework\\View\\DesignInterface'), $objectManager->get('Magento\\Framework\\Registry'), $objectManager->get('Magento\\Core\\Model\\App\\Emulation'), $objectManager->get('Magento\\Store\\Model\\StoreManager'), $objectManager->create('Magento\\Framework\\App\\Filesystem'), $objectManager->create('Magento\\Framework\\View\\Asset\\Repository'), $objectManager->create('Magento\\Framework\\View\\FileSystem'), $objectManager->create('Magento\\Framework\\App\\Config\\ScopeConfigInterface'), $objectManager->get('Magento\\Email\\Model\\Template\\FilterFactory'), $objectManager->get('Magento\\Email\\Model\\Template\\Config')))->getMock();
     $objectManager->get('Magento\\Framework\\App\\State')->setAreaCode('frontend');
     $this->_model->expects($this->any())->method('_getMail')->will($this->returnCallback(array($this, 'getMail')));
     $this->_model->setSenderName('sender')->setSenderEmail('*****@*****.**')->setTemplateSubject('Subject');
 }
示例#2
0
 protected function mockModel($filesystem = null)
 {
     if (!$filesystem) {
         $filesystem = $this->objectManager->create('Magento\\Framework\\Filesystem');
     }
     $this->mail = $this->getMock('Zend_Mail', ['send', 'addTo', 'addBcc', 'setReturnPath', 'setReplyTo'], ['utf-8']);
     $this->model = $this->getMockBuilder('Magento\\Email\\Model\\Template')->setMethods(['_getMail'])->setConstructorArgs([$this->objectManager->get('Magento\\Framework\\Model\\Context'), $this->objectManager->get('Magento\\Framework\\View\\DesignInterface'), $this->objectManager->get('Magento\\Framework\\Registry'), $this->objectManager->get('Magento\\Store\\Model\\App\\Emulation'), $this->objectManager->get('Magento\\Store\\Model\\StoreManager'), $this->objectManager->create('Magento\\Framework\\View\\Asset\\Repository'), $filesystem, $this->objectManager->create('Magento\\Framework\\App\\Config\\ScopeConfigInterface'), $this->objectManager->get('Magento\\Email\\Model\\Template\\Config'), $this->objectManager->get('Magento\\Email\\Model\\TemplateFactory'), $this->objectManager->get('Magento\\Framework\\Filter\\FilterManager'), $this->objectManager->get('Magento\\Framework\\UrlInterface'), $this->objectManager->get('Magento\\Email\\Model\\Template\\FilterFactory')])->getMock();
     $this->objectManager->get('Magento\\Framework\\App\\State')->setAreaCode('frontend');
     $this->model->expects($this->any())->method('_getMail')->will($this->returnCallback([$this, 'getMail']));
     $this->model->setSenderName('sender')->setSenderEmail('*****@*****.**')->setTemplateSubject('Subject');
 }