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
 /**
  * @param string $messageType
  * @param string $status
  * @param string $notice
  * @dataProvider linkNotAvailableDataProvider
  */
 public function testLinkNotAvailable($messageType, $status, $notice)
 {
     $this->objectManager->expects($this->at(0))->method('get')->with('Magento\\Customer\\Model\\Session')->willReturn($this->session);
     $this->request->expects($this->once())->method('getParam')->with('id', 0)->willReturn('some_id');
     $this->objectManager->expects($this->at(1))->method('create')->with('Magento\\Downloadable\\Model\\Link\\Purchased\\Item')->willReturn($this->linkPurchasedItem);
     $this->linkPurchasedItem->expects($this->once())->method('load')->with('some_id', 'link_hash')->willReturnSelf();
     $this->linkPurchasedItem->expects($this->once())->method('getId')->willReturn(5);
     $this->objectManager->expects($this->at(2))->method('get')->with('Magento\\Downloadable\\Helper\\Data')->willReturn($this->helperData);
     $this->helperData->expects($this->once())->method('getIsShareable')->with($this->linkPurchasedItem)->willReturn(true);
     $this->linkPurchasedItem->expects($this->any())->method('getNumberOfDownloadsBought')->willReturn(10);
     $this->linkPurchasedItem->expects($this->any())->method('getNumberOfDownloadsUsed')->willReturn(9);
     $this->linkPurchasedItem->expects($this->once())->method('getStatus')->willReturn($status);
     $this->messageManager->expects($this->once())->method($messageType)->with($notice)->willReturnSelf();
     $this->assertEquals($this->response, $this->link->execute());
 }