Esempio n. 1
0
 public function testGetItemPrice()
 {
     $html = '$34.28';
     $this->layoutMock->expects($this->once())->method('getBlock')->with('item_price')->will($this->returnValue($this->priceRenderBlock));
     $this->priceRenderBlock->expects($this->once())->method('setItem')->with($this->itemMock);
     $this->priceRenderBlock->expects($this->once())->method('toHtml')->will($this->returnValue($html));
     $this->assertEquals($html, $this->block->getItemPrice($this->itemMock));
 }
Esempio n. 2
0
 /**
  * Prepare item html
  *
  * This method uses renderer for real product type
  *
  * @return string
  */
 protected function _toHtml()
 {
     if ($this->getItem()->getOrderItem()) {
         $item = $this->getItem()->getOrderItem();
     } else {
         $item = $this->getItem();
     }
     if ($productType = $item->getRealProductType()) {
         $renderer = $this->getRenderedBlock()->getItemRenderer($productType);
         $renderer->setItem($this->getItem());
         return $renderer->toHtml();
     }
     return parent::_toHtml();
 }
Esempio n. 3
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory
  * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, array $data = [])
 {
     $this->_purchasedFactory = $purchasedFactory;
     $this->_itemsFactory = $itemsFactory;
     parent::__construct($context, $data);
 }