Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract

const VALIDATOR_WEBSITE = 'validator_website';

const VALIDATOR_TEAR_PRICE = 'validator_tear_price';
/**
* @deprecated
* @see VALIDATOR_TIER_PRICE
*/
private const VALIDATOR_TEAR_PRICE = 'validator_tier_price';

private const VALIDATOR_TIER_PRICE = 'validator_tier_price';

/**
* Validation failure message template definitions.
Expand Down Expand Up @@ -221,7 +227,7 @@ public function __construct(
$this->_catalogProductEntity = $this->_resourceFactory->create()->getTable('catalog_product_entity');
$this->_oldSkus = $this->retrieveOldSkus();
$this->_validators[self::VALIDATOR_WEBSITE] = $websiteValidator;
$this->_validators[self::VALIDATOR_TEAR_PRICE] = $tierPriceValidator;
$this->_validators[self::VALIDATOR_TIER_PRICE] = $tierPriceValidator;
$this->errorAggregator = $errorAggregator;

foreach (array_merge($this->errorMessageTemplates, $this->_messageTemplates) as $errorCode => $message) {
Expand Down Expand Up @@ -536,7 +542,7 @@ protected function getWebSiteId($websiteCode)
*/
protected function getCustomerGroupId($customerGroup)
{
$customerGroups = $this->_getValidator(self::VALIDATOR_TEAR_PRICE)->getCustomerGroups();
$customerGroups = $this->_getValidator(self::VALIDATOR_TIER_PRICE)->getCustomerGroups();
return $customerGroup == self::VALUE_ALL_GROUPS ? 0 : $customerGroups[$customerGroup];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class AdvancedPricingTest extends \Magento\ImportExport\Test\Unit\Model\Import\A
protected $websiteValidator;

/**
* @var AdvancedPricing\Validator\TearPrice |\PHPUnit_Framework_MockObject_MockObject
* @var AdvancedPricing\Validator\TierPrice |\PHPUnit_Framework_MockObject_MockObject
*/
protected $tierPriceValidator;

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Product/Type/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function getChildFinalPrice($product, $productQty, $childProduct, $childP
}

/**
* Gets the 'tear_price' array from the product
* Gets the 'tier_price' array from the product
*
* @param Product $product
* @param string $key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function testGetAffectedFields()
$attribute->expects($this->any())->method('getAttributeId')->will($this->returnValue($attributeId));
$attribute->expects($this->any())->method('isStatic')->will($this->returnValue(false));
$attribute->expects($this->any())->method('getBackendTable')->will($this->returnValue('table'));
$attribute->expects($this->any())->method('getName')->will($this->returnValue('tear_price'));
$attribute->expects($this->any())->method('getName')->will($this->returnValue('tier_price'));
$this->_model->setAttribute($attribute);

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

$this->assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class BasePriceTest extends \PHPUnit\Framework\TestCase
/**
* @var \Magento\Catalog\Pricing\Price\TierPrice|\PHPUnit_Framework_MockObject_MockObject
*/
protected $tearPriceMock;
protected $tierPriceMock;

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

Expand All @@ -69,7 +69,7 @@ protected function setUp()
->will($this->returnValue($this->priceInfoMock));
$this->prices = [
'regular_price' => $this->regularPriceMock,
'tear_price' => $this->tearPriceMock,
'tier_price' => $this->tierPriceMock,
'special_price' => $this->specialPriceMock,
];

Expand Down Expand Up @@ -97,7 +97,7 @@ public function testGetValue($specialPriceValue, $expectedResult)
$this->regularPriceMock->expects($this->exactly(3))
->method('getValue')
->will($this->returnValue(100));
$this->tearPriceMock->expects($this->exactly(2))
$this->tierPriceMock->expects($this->exactly(2))
->method('getValue')
->will($this->returnValue(99));
$this->specialPriceMock->expects($this->any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function testUpdateCatalogRuleGroupWebsiteData()
);
$resourceMock->expects($this->any())
->method('getMainTable')
->will($this->returnValue('catalog_product_entity_tear_price'));
->will($this->returnValue('catalog_product_entity_tier_price'));
$backendModelMock->expects($this->any())
->method('getResource')
->will($this->returnValue($resourceMock));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

use Magento\TestFramework\TestCase\WebapiAbstract;

/**
* Class ProductTierPriceManagementTest
*
* @package Magento\Catalog\Api
*/
class ProductTierPriceManagementTest extends WebapiAbstract
{
const SERVICE_NAME = 'catalogProductTierPriceManagementV1';
Expand All @@ -34,15 +39,15 @@ public function testGetList($customerGroupId, $count, $value, $qty)
],
];

$tearPriceList = $this->_webApiCall(
$tierPriceList = $this->_webApiCall(
$serviceInfo,
['sku' => $productSku, 'customerGroupId' => $customerGroupId]
);

$this->assertCount($count, $tearPriceList);
$this->assertCount($count, $tierPriceList);
if ($count) {
$this->assertEquals($value, $tearPriceList[0]['value']);
$this->assertEquals($qty, $tearPriceList[0]['qty']);
$this->assertEquals($value, $tierPriceList[0]['value']);
$this->assertEquals($qty, $tierPriceList[0]['qty']);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
use Magento\Catalog\Api\Data\ProductTierPriceInterface;
use Magento\TestFramework\Helper\Bootstrap;

/**
* Class FinalPriceTest
*
* @package Magento\GroupedProduct\Pricing\Price
*/
class FinalPriceTest extends \PHPUnit\Framework\TestCase
{
/**
Expand All @@ -29,7 +34,7 @@ public function testFinalPrice()
* @magentoDataFixture Magento/GroupedProduct/_files/product_grouped.php
* @magentoAppIsolation enabled
*/
public function testFinalPriceWithTearPrice()
public function testFinalPriceWithTierPrice()
{
$productRepository = Bootstrap::getObjectManager()
->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
Expand All @@ -41,9 +46,11 @@ public function testFinalPriceWithTearPrice()

/** @var $simpleProduct \Magento\Catalog\Api\Data\ProductInterface */
$simpleProduct = $productRepository->get('simple');
$simpleProduct->setTierPrices([
$tierPrice
]);
$simpleProduct->setTierPrices(
[
$tierPrice
]
);
$productRepository->save($simpleProduct);

/** @var $product \Magento\Catalog\Model\Product */
Expand Down