public function testToHtmlWithSubscriber() { $this->request->expects($this->any())->method('getParam')->willReturnMap([['id', null, 2], ['store', null, 1], ['subscriber', null, 3]]); $subscriber = $this->getMock('Magento\\Newsletter\\Model\\Subscriber', [], [], '', false); $subscriber->expects($this->atLeastOnce())->method('load')->with(3)->willReturnSelf(); $this->subscriberFactory->expects($this->atLeastOnce())->method('create')->willReturn($subscriber); $this->template->expects($this->atLeastOnce())->method('emulateDesign')->with(1); $this->template->expects($this->atLeastOnce())->method('revertDesign'); $this->appState->expects($this->atLeastOnce())->method('emulateAreaCode')->with(\Magento\Newsletter\Model\Template::DEFAULT_DESIGN_AREA, [$this->template, 'getProcessedTemplate'], [['subscriber' => $subscriber]])->willReturn('Processed Template'); $this->assertEquals('Processed Template', $this->preview->toHtml()); }
/** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory * @param \Magento\Newsletter\Model\QueueFactory $queueFactory * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory * @param array $data */ public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, \Magento\Newsletter\Model\QueueFactory $queueFactory, array $data = []) { $this->_queueFactory = $queueFactory; parent::__construct($context, $templateFactory, $subscriberFactory, $data); }