Skip to content

Commit 4a70baf

Browse files
committed
MAGETWO-98603: [2.3] Fixed Tier Pricing for Bundle items doesn't work
1 parent e630b10 commit 4a70baf

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

app/code/Magento/Bundle/Test/Unit/Block/DataProviders/OptionPriceRendererTest.php

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,20 @@ protected function setUp()
5151
/**
5252
* Test to render Tier price html
5353
*
54-
* @param bool $priceRenderExist
55-
* @param string $expectedHtml
56-
* @dataProvider renderTierPriceDataProvider
54+
* @return void
5755
*/
58-
public function testRenderTierPrice(bool $priceRenderExist, string $expectedHtml): void
56+
public function testRenderTierPrice(): void
5957
{
60-
$priceRenderer = false;
58+
$expectedHtml = 'tier price html';
6159
$expectedArguments = ['zone' => Render::ZONE_ITEM_OPTION];
60+
6261
$productMock = $this->createMock(Product::class);
6362

64-
if ($priceRenderExist) {
65-
$priceRenderer = $this->createPartialMock(BlockInterface::class, ['toHtml', 'render']);
66-
$priceRenderer->expects($this->once())
67-
->method('render')
68-
->with('tier_price', $productMock, $expectedArguments)
69-
->willReturn($expectedHtml);
70-
}
63+
$priceRenderer = $this->createPartialMock(BlockInterface::class, ['toHtml', 'render']);
64+
$priceRenderer->expects($this->once())
65+
->method('render')
66+
->with('tier_price', $productMock, $expectedArguments)
67+
->willReturn($expectedHtml);
7168

7269
$this->layoutMock->method('getBlock')
7370
->with('product.price.render.default')
@@ -81,12 +78,22 @@ public function testRenderTierPrice(bool $priceRenderExist, string $expectedHtml
8178
}
8279

8380
/**
84-
* Data provider for test to render Tier price
81+
* Test to render Tier price html when render block is not exists
8582
*
86-
* @return array
83+
* @return void
8784
*/
88-
public function renderTierPriceDataProvider(): array
85+
public function testRenderTierPriceNotExist(): void
8986
{
90-
return [[true, 'tier price html'], [false, '']];
87+
$productMock = $this->createMock(Product::class);
88+
89+
$this->layoutMock->method('getBlock')
90+
->with('product.price.render.default')
91+
->willReturn(false);
92+
93+
$this->assertEquals(
94+
'',
95+
$this->renderer->renderTierPrice($productMock),
96+
'Render Tier price is wrong'
97+
);
9198
}
9299
}

dev/tests/integration/testsuite/Magento/Bundle/_files/product_with_simple_tier_pricing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
declare(strict_types=1);
77

8-
include __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php';
8+
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php';
99

1010
/** @var $productFactory Magento\Catalog\Model\ProductFactory */
1111
$productFactory = $objectManager->create(\Magento\Catalog\Model\ProductFactory::class);

dev/tests/integration/testsuite/Magento/Bundle/_files/product_with_simple_tier_pricing_rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
declare(strict_types=1);
77

8-
include __DIR__ . '/../../../Magento/Catalog/_files/product_simple_rollback.php';
8+
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_rollback.php';
99

1010
/** @var \Magento\Framework\Registry $registry */
1111
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);

0 commit comments

Comments
 (0)