22 private $objectManager;
51 $this->price = $this->createMock(TierPrice::class);
52 $this->priceInfo = $this->getMockForAbstractClass(PriceInfoInterface::class);
53 $this->saleable = $this->getMockForAbstractClass(SaleableInterface::class);
57 $this->calculator = $this->getMockForAbstractClass(CalculatorInterface::class);
58 $this->
object = $this->objectManager->getObject(
59 MinimalTierPriceCalculator::class,
60 [
'calculator' => $this->calculator]
67 private function getValueTierPricesExistShouldReturnMinTierPrice()
72 $minAmount = $this->getMockForAbstractClass(AmountInterface::class);
73 $minAmount->expects($this->once())->method(
'getValue')->willReturn($minPrice);
75 $notMinAmount = $this->getMockForAbstractClass(AmountInterface::class);
76 $notMinAmount->expects($this->once())->method(
'getValue')->willReturn($notMinPrice);
83 'price' => $notMinAmount
87 $this->price->expects($this->once())->method(
'getTierPriceList')->willReturn($tierPriceList);
90 ->willReturn($this->price);
92 $this->saleable->expects($this->once())->method(
'getPriceInfo')->willReturn($this->priceInfo);
98 $minPrice = $this->getValueTierPricesExistShouldReturnMinTierPrice();
99 $this->assertEquals($minPrice, $this->object->getValue($this->saleable));
104 $minPrice = $this->getValueTierPricesExistShouldReturnMinTierPrice();
106 $amount = $this->getMockForAbstractClass(AmountInterface::class);
108 $this->calculator->expects($this->once())
109 ->method(
'getAmount')
110 ->with($minPrice, $this->saleable)
113 $this->assertSame(
$amount, $this->object->getAmount($this->saleable));
testGetGetAmountMinTierPriceExistShouldReturnAmountObject()
testGetValueTierPricesExistShouldReturnMinTierPrice()