Skip to content

Commit 1337169

Browse files
authored
ENGCOM-5782: tear price change with tier price #24160
2 parents 9da9ae3 + e7542da commit 1337169

File tree

8 files changed

+38
-20
lines changed

8 files changed

+38
-20
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract
5050

5151
const VALIDATOR_WEBSITE = 'validator_website';
5252

53-
const VALIDATOR_TEAR_PRICE = 'validator_tear_price';
53+
/**
54+
* @deprecated
55+
* @see VALIDATOR_TIER_PRICE
56+
*/
57+
private const VALIDATOR_TEAR_PRICE = 'validator_tier_price';
58+
59+
private const VALIDATOR_TIER_PRICE = 'validator_tier_price';
5460

5561
/**
5662
* Validation failure message template definitions.
@@ -221,7 +227,7 @@ public function __construct(
221227
$this->_catalogProductEntity = $this->_resourceFactory->create()->getTable('catalog_product_entity');
222228
$this->_oldSkus = $this->retrieveOldSkus();
223229
$this->_validators[self::VALIDATOR_WEBSITE] = $websiteValidator;
224-
$this->_validators[self::VALIDATOR_TEAR_PRICE] = $tierPriceValidator;
230+
$this->_validators[self::VALIDATOR_TIER_PRICE] = $tierPriceValidator;
225231
$this->errorAggregator = $errorAggregator;
226232

227233
foreach (array_merge($this->errorMessageTemplates, $this->_messageTemplates) as $errorCode => $message) {
@@ -536,7 +542,7 @@ protected function getWebSiteId($websiteCode)
536542
*/
537543
protected function getCustomerGroupId($customerGroup)
538544
{
539-
$customerGroups = $this->_getValidator(self::VALIDATOR_TEAR_PRICE)->getCustomerGroups();
545+
$customerGroups = $this->_getValidator(self::VALIDATOR_TIER_PRICE)->getCustomerGroups();
540546
return $customerGroup == self::VALUE_ALL_GROUPS ? 0 : $customerGroups[$customerGroup];
541547
}
542548

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class AdvancedPricingTest extends \Magento\ImportExport\Test\Unit\Model\Import\A
5454
protected $websiteValidator;
5555

5656
/**
57-
* @var AdvancedPricing\Validator\TearPrice |\PHPUnit_Framework_MockObject_MockObject
57+
* @var AdvancedPricing\Validator\TierPrice |\PHPUnit_Framework_MockObject_MockObject
5858
*/
5959
protected $tierPriceValidator;
6060

app/code/Magento/Catalog/Model/Product/Type/Price.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function getChildFinalPrice($product, $productQty, $childProduct, $childP
204204
}
205205

206206
/**
207-
* Gets the 'tear_price' array from the product
207+
* Gets the 'tier_price' array from the product
208208
*
209209
* @param Product $product
210210
* @param string $key

app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public function testGetAffectedFields()
6565
$attribute->expects($this->any())->method('getAttributeId')->will($this->returnValue($attributeId));
6666
$attribute->expects($this->any())->method('isStatic')->will($this->returnValue(false));
6767
$attribute->expects($this->any())->method('getBackendTable')->will($this->returnValue('table'));
68-
$attribute->expects($this->any())->method('getName')->will($this->returnValue('tear_price'));
68+
$attribute->expects($this->any())->method('getName')->will($this->returnValue('tier_price'));
6969
$this->_model->setAttribute($attribute);
7070

7171
$object = new \Magento\Framework\DataObject();
72-
$object->setTearPrice([['price_id' => 10]]);
72+
$object->setTierPrice([['price_id' => 10]]);
7373
$object->setId(555);
7474

7575
$this->assertEquals(

app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class BasePriceTest extends \PHPUnit\Framework\TestCase
3939
/**
4040
* @var \Magento\Catalog\Pricing\Price\TierPrice|\PHPUnit_Framework_MockObject_MockObject
4141
*/
42-
protected $tearPriceMock;
42+
protected $tierPriceMock;
4343

4444
/**
4545
* @var \Magento\Catalog\Pricing\Price\SpecialPrice|\PHPUnit_Framework_MockObject_MockObject
@@ -60,7 +60,7 @@ protected function setUp()
6060
$this->saleableItemMock = $this->createMock(\Magento\Catalog\Model\Product::class);
6161
$this->priceInfoMock = $this->createMock(\Magento\Framework\Pricing\PriceInfo\Base::class);
6262
$this->regularPriceMock = $this->createMock(\Magento\Catalog\Pricing\Price\RegularPrice::class);
63-
$this->tearPriceMock = $this->createMock(\Magento\Catalog\Pricing\Price\TierPrice::class);
63+
$this->tierPriceMock = $this->createMock(\Magento\Catalog\Pricing\Price\TierPrice::class);
6464
$this->specialPriceMock = $this->createMock(\Magento\Catalog\Pricing\Price\SpecialPrice::class);
6565
$this->calculatorMock = $this->createMock(\Magento\Framework\Pricing\Adjustment\Calculator::class);
6666

@@ -69,7 +69,7 @@ protected function setUp()
6969
->will($this->returnValue($this->priceInfoMock));
7070
$this->prices = [
7171
'regular_price' => $this->regularPriceMock,
72-
'tear_price' => $this->tearPriceMock,
72+
'tier_price' => $this->tierPriceMock,
7373
'special_price' => $this->specialPriceMock,
7474
];
7575

@@ -97,7 +97,7 @@ public function testGetValue($specialPriceValue, $expectedResult)
9797
$this->regularPriceMock->expects($this->exactly(3))
9898
->method('getValue')
9999
->will($this->returnValue(100));
100-
$this->tearPriceMock->expects($this->exactly(2))
100+
$this->tierPriceMock->expects($this->exactly(2))
101101
->method('getValue')
102102
->will($this->returnValue(99));
103103
$this->specialPriceMock->expects($this->any())

app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function testUpdateCatalogRuleGroupWebsiteData()
252252
);
253253
$resourceMock->expects($this->any())
254254
->method('getMainTable')
255-
->will($this->returnValue('catalog_product_entity_tear_price'));
255+
->will($this->returnValue('catalog_product_entity_tier_price'));
256256
$backendModelMock->expects($this->any())
257257
->method('getResource')
258258
->will($this->returnValue($resourceMock));

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
use Magento\TestFramework\TestCase\WebapiAbstract;
1111

12+
/**
13+
* Class ProductTierPriceManagementTest
14+
*
15+
* @package Magento\Catalog\Api
16+
*/
1217
class ProductTierPriceManagementTest extends WebapiAbstract
1318
{
1419
const SERVICE_NAME = 'catalogProductTierPriceManagementV1';
@@ -34,15 +39,15 @@ public function testGetList($customerGroupId, $count, $value, $qty)
3439
],
3540
];
3641

37-
$tearPriceList = $this->_webApiCall(
42+
$tierPriceList = $this->_webApiCall(
3843
$serviceInfo,
3944
['sku' => $productSku, 'customerGroupId' => $customerGroupId]
4045
);
4146

42-
$this->assertCount($count, $tearPriceList);
47+
$this->assertCount($count, $tierPriceList);
4348
if ($count) {
44-
$this->assertEquals($value, $tearPriceList[0]['value']);
45-
$this->assertEquals($qty, $tearPriceList[0]['qty']);
49+
$this->assertEquals($value, $tierPriceList[0]['value']);
50+
$this->assertEquals($qty, $tierPriceList[0]['qty']);
4651
}
4752
}
4853

dev/tests/integration/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
use Magento\Catalog\Api\Data\ProductTierPriceInterface;
1010
use Magento\TestFramework\Helper\Bootstrap;
1111

12+
/**
13+
* Class FinalPriceTest
14+
*
15+
* @package Magento\GroupedProduct\Pricing\Price
16+
*/
1217
class FinalPriceTest extends \PHPUnit\Framework\TestCase
1318
{
1419
/**
@@ -29,7 +34,7 @@ public function testFinalPrice()
2934
* @magentoDataFixture Magento/GroupedProduct/_files/product_grouped.php
3035
* @magentoAppIsolation enabled
3136
*/
32-
public function testFinalPriceWithTearPrice()
37+
public function testFinalPriceWithTierPrice()
3338
{
3439
$productRepository = Bootstrap::getObjectManager()
3540
->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
@@ -41,9 +46,11 @@ public function testFinalPriceWithTearPrice()
4146

4247
/** @var $simpleProduct \Magento\Catalog\Api\Data\ProductInterface */
4348
$simpleProduct = $productRepository->get('simple');
44-
$simpleProduct->setTierPrices([
45-
$tierPrice
46-
]);
49+
$simpleProduct->setTierPrices(
50+
[
51+
$tierPrice
52+
]
53+
);
4754
$productRepository->save($simpleProduct);
4855

4956
/** @var $product \Magento\Catalog\Model\Product */

0 commit comments

Comments
 (0)