/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $stringCompiler = new Shopware_Components_StringCompiler(Shopware()->Template()); $manager = $this->getMockBuilder('Shopware\\Components\\Model\\ModelManager')->disableOriginalConstructor()->getMock(); $manager->expects($this->any())->method('getRepository')->will($this->returnSelf()); $manager->expects($this->any())->method('findOneBy')->will($this->returnValue(false)); $this->mail = new Shopware_Components_TemplateMail(); $this->mail->setShop(Shopware()->Shop()); $this->mail->setModelManager($manager); $this->mail->setStringCompiler($stringCompiler); }
/** * @return \Shopware_Components_TemplateMail */ public function initTemplateMail() { $this->loadResource('MailTransport'); $stringCompiler = new Shopware_Components_StringCompiler( $this->getResource('Template') ); $mailer = new Shopware_Components_TemplateMail(); if($this->issetResource('Shop')) { $mailer->setShop($this->getResource('Shop')); } $mailer->setModelManager($this->getResource('Models')); $mailer->setStringCompiler($stringCompiler); return $mailer; }
/** * @param Container $container * @return \Shopware_Components_TemplateMail */ public function factory(Container $container) { $container->load('MailTransport'); $stringCompiler = new \Shopware_Components_StringCompiler($container->get('Template')); $mailer = new \Shopware_Components_TemplateMail(); if ($container->initialized('Shop')) { $mailer->setShop($container->get('Shop')); } $mailer->setModelManager($container->get('Models')); $mailer->setStringCompiler($stringCompiler); return $mailer; }