49 $this->saleableItemMock = $this->createMock(\
Magento\Catalog\Model\Product::class);
50 $this->amountMock = $this->createMock(\
Magento\Framework\Pricing\Amount\Base::class);
51 $this->calculatorMock = $this->createMock(\
Magento\Framework\Pricing\Adjustment\Calculator::class);
52 $this->linkMock = $this->createPartialMock(
53 \
Magento\Downloadable\Model\Link::class,
54 [
'getPrice',
'getProduct',
'__wakeup']
57 $this->priceCurrencyMock = $this->createMock(\
Magento\Framework\Pricing\PriceCurrencyInterface::class);
59 $this->linkPrice = new \Magento\Downloadable\Pricing\Price\LinkPrice(
60 $this->saleableItemMock,
62 $this->calculatorMock,
63 $this->priceCurrencyMock
70 $convertedAmount = 50;
72 $this->linkMock->expects($this->once())
74 ->will($this->returnValue(
$amount));
75 $this->linkMock->expects($this->once())
76 ->method(
'getProduct')
77 ->will($this->returnValue($this->saleableItemMock));
78 $this->priceCurrencyMock->expects($this->once())
79 ->method(
'convertAndRound')
81 ->will($this->returnValue($convertedAmount));
82 $this->calculatorMock->expects($this->once())
84 ->with($convertedAmount, $this->equalTo($this->saleableItemMock))
85 ->will($this->returnValue($convertedAmount));
87 $result = $this->linkPrice->getLinkAmount($this->linkMock);
88 $this->assertEquals($convertedAmount,
$result);