|
10 | 10 |
|
11 | 11 | use Magento\Catalog\Pricing\Price\TierPrice;
|
12 | 12 | use Magento\Catalog\Pricing\Price\FinalPrice;
|
| 13 | +use Magento\Framework\Pricing\Amount\AmountInterface; |
| 14 | +use Magento\Framework\Pricing\Price\PriceInterface; |
13 | 15 | use Magento\Customer\Model\Group;
|
14 | 16 | use Magento\Customer\Model\GroupManagement;
|
15 | 17 |
|
@@ -250,7 +252,7 @@ public function testGetterTierPriceList($tierPrices, $basePrice, $expectedResult
|
250 | 252 | {
|
251 | 253 | $this->product->setData(TierPrice::PRICE_CODE, $tierPrices);
|
252 | 254 |
|
253 |
| - $price = $this->createMock(\Magento\Framework\Pricing\Price\PriceInterface::class); |
| 255 | + $price = $this->createMock(PriceInterface::class); |
254 | 256 | $price->expects($this->any())->method('getValue')->will($this->returnValue($basePrice));
|
255 | 257 |
|
256 | 258 | $this->calculator->expects($this->atLeastOnce())->method('getAmount')
|
@@ -341,27 +343,37 @@ public function providerForGetterTierPriceList()
|
341 | 343 | }
|
342 | 344 |
|
343 | 345 | /**
|
344 |
| - * @covers \Magento\Catalog\Pricing\Price\TierPrice::__construct |
345 |
| - * @covers \Magento\Catalog\Pricing\Price\TierPrice::getSavePercent |
346 |
| - * @covers \Magento\Catalog\Pricing\Price\TierPrice::getBasePrice |
| 346 | + * @param float $basePrice |
| 347 | + * @param float $tierPrice |
| 348 | + * @param float $savedPercent |
| 349 | + * |
347 | 350 | * @dataProvider dataProviderGetSavePercent
|
348 | 351 | */
|
349 | 352 | public function testGetSavePercent($basePrice, $tierPrice, $savedPercent)
|
350 | 353 | {
|
351 |
| - $price = $this->createMock(\Magento\Framework\Pricing\Price\PriceInterface::class); |
| 354 | + /** @var AmountInterface|\PHPUnit_Framework_MockObject_MockObject $amount */ |
| 355 | + $amount = $this->getMockForAbstractClass(AmountInterface::class); |
352 | 356 |
|
353 |
| - $this->priceInfo->expects(static::atLeastOnce()) |
354 |
| - ->method('getPrice') |
355 |
| - ->with(FinalPrice::PRICE_CODE) |
356 |
| - ->willReturn($price); |
357 |
| - $price->expects(static::atLeastOnce()) |
| 357 | + $amount->expects($this->any()) |
| 358 | + ->method('getValue') |
| 359 | + ->willReturn($tierPrice); |
| 360 | + |
| 361 | + $basePriceAmount = $this->getMockForAbstractClass(AmountInterface::class); |
| 362 | + |
| 363 | + $basePriceAmount->expects($this->any()) |
358 | 364 | ->method('getValue')
|
359 | 365 | ->willReturn($basePrice);
|
360 | 366 |
|
361 |
| - $amount = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Amount\AmountInterface::class); |
362 |
| - $amount->expects($this->atLeastOnce()) |
363 |
| - ->method('getBaseAmount') |
364 |
| - ->will($this->returnValue($tierPrice)); |
| 367 | + $price = $this->getMockForAbstractClass(PriceInterface::class); |
| 368 | + |
| 369 | + $price->expects($this->any()) |
| 370 | + ->method('getAmount') |
| 371 | + ->willReturn($basePriceAmount); |
| 372 | + |
| 373 | + $this->priceInfo->expects($this->any()) |
| 374 | + ->method('getPrice') |
| 375 | + ->with(FinalPrice::PRICE_CODE) |
| 376 | + ->willReturn($price); |
365 | 377 |
|
366 | 378 | $this->assertEquals($savedPercent, $this->model->getSavePercent($amount));
|
367 | 379 | }
|
|
0 commit comments