Example #1
0
 public function testExecuteWithException()
 {
     $objectMock = $this->getMockBuilder('Magento\\Framework\\DataObject')->disableOriginalConstructor()->getMock();
     $this->transactionMock->expects($this->once())->method('getResponseObject')->willReturn($objectMock);
     $this->responseValidatorMock->expects($this->once())->method('validate')->with($objectMock)->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('Error')));
     $this->coreRegistryMock->expects($this->once())->method('register')->with('transparent_form_params', $this->arrayHasKey('error'));
     $this->resultLayoutMock->expects($this->once())->method('addDefaultHandle')->willReturnSelf();
     $this->resultLayoutMock->expects($this->once())->method('getLayout')->willReturn($this->getLayoutMock());
     $this->assertInstanceOf('\\Magento\\Framework\\Controller\\ResultInterface', $this->object->executeInternal());
 }
 public function testAddDefaultHandle()
 {
     $processor = $this->getMock('Magento\\Framework\\View\\Layout\\ProcessorInterface', [], [], '', false);
     $processor->expects($this->once())->method('addHandle')->with('module_controller_action');
     $this->layout->expects($this->once())->method('getUpdate')->will($this->returnValue($processor));
     $this->request->expects($this->once())->method('getFullActionName')->will($this->returnValue('Module_Controller_Action'));
     $this->assertSame($this->resultLayout, $this->resultLayout->addDefaultHandle());
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function renderResult(\Magento\Framework\App\ResponseInterface $response)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'renderResult');
     if (!$pluginInfo) {
         return parent::renderResult($response);
     } else {
         return $this->___callPlugins('renderResult', func_get_args(), $pluginInfo);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function setStatusHeader($httpCode, $version = null, $phrase = null)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setStatusHeader');
     if (!$pluginInfo) {
         return parent::setStatusHeader($httpCode, $version, $phrase);
     } else {
         return $this->___callPlugins('setStatusHeader', func_get_args(), $pluginInfo);
     }
 }
Example #5
0
 /**
  * Retrieve wishlist items content (html)
  *
  * @param \Magento\Framework\View\Result\Layout $resultLayout
  * @return string
  */
 protected function getWishlistItems(ResultLayout $resultLayout)
 {
     return $resultLayout->getLayout()->getBlock('wishlist.email.items')->toHtml();
 }
Example #6
0
 /**
  * @param ResponseInterface $response
  * @return $this
  */
 protected function render(ResponseInterface $response)
 {
     $this->pageConfig->publicBuild();
     if ($this->getPageLayout()) {
         $config = $this->getConfig();
         $this->addDefaultBodyClasses();
         $addBlock = $this->getLayout()->getBlock('head.additional');
         // todo
         $requireJs = $this->getLayout()->getBlock('require.js');
         $this->assign(['requireJs' => $requireJs ? $requireJs->toHtml() : null, 'headContent' => $this->pageConfigRenderer->renderHeadContent(), 'headAdditional' => $addBlock ? $addBlock->toHtml() : null, 'htmlAttributes' => $this->pageConfigRenderer->renderElementAttributes($config::ELEMENT_TYPE_HTML), 'headAttributes' => $this->pageConfigRenderer->renderElementAttributes($config::ELEMENT_TYPE_HEAD), 'bodyAttributes' => $this->pageConfigRenderer->renderElementAttributes($config::ELEMENT_TYPE_BODY), 'loaderIcon' => $this->getViewFileUrl('images/loader-2.gif')]);
         $output = $this->getLayout()->getOutput();
         $this->assign('layoutContent', $output);
         $output = $this->renderPage();
         $this->translateInline->processResponseBody($output);
         $response->appendBody($output);
     } else {
         parent::render($response);
     }
     return $this;
 }
Example #7
0
 /**
  * @param ResponseInterface $response
  * @return $this
  */
 public function renderResult(ResponseInterface $response)
 {
     if ($this->getConfig()->getPageLayout()) {
         $layout = $this->getLayout();
         $config = $this->getConfig();
         $this->assign('headContent', $layout->getBlock('head')->toHtml());
         $this->addDefaultBodyClasses();
         $this->assign('bodyClasses', $config->getElementAttribute($config::ELEMENT_TYPE_BODY, 'classes'));
         $this->assign('bodyAttributes', $config->getElementAttribute($config::ELEMENT_TYPE_BODY, 'attributes'));
         $this->assign('htmlAttributes', $config->getElementAttribute($config::ELEMENT_TYPE_HTML, 'attributes'));
         $output = $layout->getOutput();
         $this->translateInline->processResponseBody($output);
         $this->assign('layoutContent', $output);
         $response->appendBody($this->toHtml());
     } else {
         parent::renderResult($response);
     }
     return $this;
 }