11 use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory;
12 use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
21 private $productRepository;
26 private $objectManager;
31 private $productCollectionFactory;
36 $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
37 $this->productCollectionFactory = $this->objectManager->create(CollectionFactory::class);
44 public function testTierPrice()
46 $tierPriceValue = 9.00;
48 $tierPrice = $this->objectManager->create(ProductTierPriceInterfaceFactory::class)
50 $tierPrice->setCustomerGroupId(Group::CUST_GROUP_ALL);
51 $tierPrice->setQty(1.00);
52 $tierPrice->setValue($tierPriceValue);
53 $tierPriceManagement = $this->objectManager->create(ScopedProductTierPriceManagementInterface::class);
54 $tierPriceManagement->add(
'simple333', $tierPrice);
62 $tierPrice =
$product->getPriceInfo()
63 ->getPrice(TierPrice::PRICE_CODE)
66 $this->assertEquals($tierPriceValue, $tierPrice);
68 $tierPrice =
$product->getTierPrice(1);
69 $this->assertEquals($tierPriceValue, $tierPrice);
72 $this->assertEquals($tierPriceValue,
$tierPrices[0][
'price']);
74 $minPrice =
$product->getData(
'min_price');
75 $this->assertEquals($tierPriceValue, $minPrice);
static getObjectManager()