Skip to content

Commit 11d4a9f

Browse files
MC-39282: Bundled product cannot be saved when tier price is assigned and Magento\Framework\Api\ExtensibleDataObjectConverter is used to convert product data
1 parent b58d1f9 commit 11d4a9f

File tree

1 file changed

+36
-0
lines changed
  • app/code/Magento/Catalog/Test/Unit/Model/Product/Type

1 file changed

+36
-0
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,40 @@ function () {
263263
);
264264
}
265265
}
266+
267+
/**
268+
* Get tier price with percent value type
269+
*
270+
* @return void
271+
*/
272+
public function testGetPricesWithPercentType(): void
273+
{
274+
$tierPrices = [
275+
0 => [
276+
'record_id' => 0,
277+
'cust_group' => 3200,
278+
'price_qty' => 3,
279+
'website_id' => 0,
280+
'value_type' => 'percent',
281+
'percentage_value' => 10,
282+
],
283+
];
284+
$this->product->setData('tier_price', $tierPrices);
285+
$this->tpFactory->expects($this->any())
286+
->method('create')
287+
->willReturnCallback(
288+
function () {
289+
return $this->objectManagerHelper->getObject(TierPrice::class);
290+
}
291+
);
292+
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
293+
->onlyMethods(['getPercentageValue', 'setPercentageValue'])
294+
->getMockForAbstractClass();
295+
$tierPriceExtensionMock->method('getPercentageValue')
296+
->willReturn(50);
297+
$this->tierPriceExtensionFactoryMock->method('create')
298+
->willReturn($tierPriceExtensionMock);
299+
300+
$this->assertInstanceOf(TierPrice::class, $this->model->getTierPrices($this->product)[0]);
301+
}
266302
}

0 commit comments

Comments
 (0)