Esempio n. 1
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);
     }
 }
Esempio n. 2
0
 /**
  * @dataProvider executeDataProvider
  * @param string $fileType
  */
 public function testExecuteUrl($fileType)
 {
     $this->request->expects($this->at(0))->method('getParam')->with('id', 0)->will($this->returnValue(1));
     $this->request->expects($this->at(1))->method('getParam')->with('type', 0)->will($this->returnValue($fileType));
     $this->response->expects($this->once())->method('setHttpResponseCode')->will($this->returnSelf());
     $this->response->expects($this->once())->method('clearBody')->will($this->returnSelf());
     $this->response->expects($this->any())->method('setHeader')->will($this->returnSelf());
     $this->response->expects($this->once())->method('sendHeaders')->will($this->returnSelf());
     $this->objectManager->expects($this->at(1))->method('get')->with('Magento\\Downloadable\\Helper\\Download')->will($this->returnValue($this->downloadHelper));
     $this->downloadHelper->expects($this->once())->method('setResource')->will($this->returnSelf());
     $this->downloadHelper->expects($this->once())->method('getFilename')->will($this->returnValue('link.jpg'));
     $this->downloadHelper->expects($this->once())->method('getContentType')->will($this->returnSelf('url'));
     $this->downloadHelper->expects($this->once())->method('getFileSize')->will($this->returnValue(null));
     $this->downloadHelper->expects($this->once())->method('getContentDisposition')->will($this->returnValue(null));
     $this->downloadHelper->expects($this->once())->method('output')->will($this->returnSelf());
     $this->linkModel->expects($this->once())->method('load')->will($this->returnSelf());
     $this->linkModel->expects($this->once())->method('getId')->will($this->returnValue('1'));
     $this->linkModel->expects($this->once())->method('get' . $fileType . 'Type')->will($this->returnValue('url'));
     $this->linkModel->expects($this->once())->method('get' . $fileType . 'Url')->will($this->returnValue('http://url.magento.com'));
     $this->objectManager->expects($this->once())->method('create')->will($this->returnValue($this->linkModel));
     $this->link->execute();
 }