Пример #1
0
 public function testExecute()
 {
     $layout = $this->getMock('\\Magento\\Framework\\View\\Layout', ['getBlock', 'initMessages'], [], '', false);
     $block = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Element\\AbstractBlock', ['setFormAction'], '', false);
     $layout->expects($this->once())->method('getBlock')->with('contactForm')->will($this->returnValue($block));
     $this->_view->expects($this->once())->method('loadLayout');
     $this->_view->expects($this->exactly(1))->method('getLayout')->will($this->returnValue($layout));
     $this->_view->expects($this->once())->method('renderLayout');
     $this->_controller->execute();
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function getResponse()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getResponse');
     if (!$pluginInfo) {
         return parent::getResponse();
     } else {
         return $this->___callPlugins('getResponse', func_get_args(), $pluginInfo);
     }
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch');
     if (!$pluginInfo) {
         return parent::dispatch($request);
     } else {
         return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo);
     }
 }
Пример #4
0
 public function testExecuteValidPost()
 {
     $post = ['name' => 'Name', 'comment' => 'Comment', 'email' => '*****@*****.**', 'hideit' => null];
     $this->_request->expects($this->any())->method('getPostValue')->will($this->returnValue($post));
     $transport = $this->getMock('\\Magento\\Framework\\Mail\\TransportInterface', [], [], '', false);
     $this->_transportBuilder->expects($this->once())->method('setTemplateIdentifier')->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('setTemplateOptions')->with(['area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID])->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('setTemplateVars')->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('setFrom')->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('addTo')->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('setReplyTo')->with($post['email'])->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('getTransport')->will($this->returnValue($transport));
     $transport->expects($this->once())->method('sendMessage');
     $this->_inlineTranslation->expects($this->once())->method('resume');
     $this->_inlineTranslation->expects($this->once())->method('suspend');
     $this->_controller->execute();
 }
Пример #5
0
 public function testExecuteValidPost()
 {
     $post = ['name' => 'Name', 'comment' => 'Comment', 'email' => '*****@*****.**', 'hideit' => null];
     $this->_request->expects($this->any())->method('getPost')->will($this->returnValue($post));
     $store = $this->getMock('\\Magento\\Store\\Model\\Store', ['getId', '__sleep', '__wakeup'], [], '', false);
     $store->expects($this->once())->method('getId')->will($this->returnValue(1));
     $this->_storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store));
     $transport = $this->getMock('\\Magento\\Framework\\Mail\\TransportInterface', [], [], '', false);
     $this->_transportBuilder->expects($this->once())->method('setTemplateIdentifier')->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('setTemplateOptions')->with(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 1])->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('setTemplateVars')->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('setFrom')->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('addTo')->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('setReplyTo')->with($post['email'])->will($this->returnSelf());
     $this->_transportBuilder->expects($this->once())->method('getTransport')->will($this->returnValue($transport));
     $transport->expects($this->once())->method('sendMessage');
     $this->_inlineTranslation->expects($this->once())->method('resume');
     $this->_inlineTranslation->expects($this->once())->method('suspend');
     $this->_controller->execute();
 }
Пример #6
0
 public function testExecute()
 {
     $this->_view->expects($this->once())->method('loadLayout');
     $this->_view->expects($this->once())->method('renderLayout');
     $this->_controller->execute();
 }