Example #1
0
 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());
 }