Skip to content

Commit 584edb8

Browse files
committed
MC-42443: Row Sub Total is not updated with new price when Price is updated through API
- Fixed the CR comments.
1 parent bd73c49 commit 584edb8

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

dev/tests/integration/testsuite/Magento/Quote/Model/Product/Plugin/UpdateQuoteTest.php

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77

88
namespace Magento\Quote\Model\Product\Plugin;
99

10-
use Magento\Quote\Model\ResourceModel\Quote as QuoteResource;
1110
use Magento\TestFramework\Helper\Bootstrap;
1211
use Magento\TestFramework\Quote\Model\GetQuoteByReservedOrderId;
12+
use Magento\Catalog\Api\TierPriceStorageInterface;
13+
use Magento\Catalog\Api\Data\TierPriceInterface;
1314
use PHPUnit\Framework\TestCase;
1415

1516
/**
1617
* Tests for update quote plugin.
17-
*
18-
* @magentoAppArea adminhtml
1918
*/
2019
class UpdateQuoteTest extends TestCase
2120
{
@@ -24,6 +23,16 @@ class UpdateQuoteTest extends TestCase
2423
*/
2524
private $getQuoteByReservedOrderId;
2625

26+
/**
27+
* @var TierPriceStorageInterface
28+
*/
29+
private $tierPriceStorage;
30+
31+
/**
32+
* @var TierPriceInterface
33+
*/
34+
private $tierPrice;
35+
2736
/**
2837
* @inheritdoc
2938
*/
@@ -33,6 +42,8 @@ protected function setUp(): void
3342

3443
$objectManager = Bootstrap::getObjectManager();
3544
$this->getQuoteByReservedOrderId = $objectManager->get(GetQuoteByReservedOrderId::class);
45+
$this->tierPriceStorage = $objectManager->get(TierPriceStorageInterface::class);
46+
$this->tierPrice = $objectManager->get(TierPriceInterface::class);
3647
}
3748

3849
/**
@@ -43,16 +54,24 @@ protected function setUp(): void
4354
*/
4455
public function testUpdateQuoteRecollectAfterChangeProductPrice(): void
4556
{
46-
$quote = $this->getQuoteByReservedOrderId->execute('test_order_with_simple_product_without_address');
57+
$quoteId = 'test_order_with_simple_product_without_address';
58+
$quote = $this->getQuoteByReservedOrderId->execute($quoteId);
4759
$this->assertNotNull($quote);
4860
$this->assertFalse((bool)$quote->getTriggerRecollect());
4961
$this->assertNotEmpty($quote->getItems());
5062
$quoteItem = current($quote->getItems());
5163
$product = $quoteItem->getProduct();
5264

65+
$this->tierPrice->setPrice($product->getPrice());
66+
$this->tierPrice->setPriceType('fixed');
67+
$this->tierPrice->setWebsiteId(0);
68+
$this->tierPrice->setSku($product->getSku());
69+
$this->tierPrice->setCustomerGroup('ALL GROUPS');
70+
$this->tierPrice->setQuantity(1);
71+
$this->tierPriceStorage->update([$this->tierPrice]);
72+
5373
/** @var QuoteResource $quoteResource */
5474
$quoteResource = $quote->getResource();
55-
$quoteResource->markQuotesRecollect($product->getId());
5675
/** @var AdapterInterface $connection */
5776
$connection = $quoteResource->getConnection();
5877
$select = $connection->select()

0 commit comments

Comments
 (0)