Skip to content

Commit f4426ef

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 b4f9bee commit f4426ef

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

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

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\TestFramework\Helper\Bootstrap;
1111
use Magento\TestFramework\Quote\Model\GetQuoteByReservedOrderId;
1212
use Magento\Catalog\Api\TierPriceStorageInterface;
13-
use Magento\Catalog\Api\Data\TierPriceInterface;
13+
use Magento\Catalog\Api\Data\TierPriceInterfaceFactory;
1414
use PHPUnit\Framework\TestCase;
1515

1616
/**
@@ -29,9 +29,9 @@ class UpdateQuoteTest extends TestCase
2929
private $tierPriceStorage;
3030

3131
/**
32-
* @var TierPriceInterface
32+
* @var TierPriceInterfaceFactory
3333
*/
34-
private $tierPrice;
34+
private $tierPriceFactory;
3535

3636
/**
3737
* @inheritdoc
@@ -43,7 +43,7 @@ protected function setUp(): void
4343
$objectManager = Bootstrap::getObjectManager();
4444
$this->getQuoteByReservedOrderId = $objectManager->get(GetQuoteByReservedOrderId::class);
4545
$this->tierPriceStorage = $objectManager->get(TierPriceStorageInterface::class);
46-
$this->tierPrice = $objectManager->get(TierPriceInterface::class);
46+
$this->tierPriceFactory = $objectManager->get(TierPriceInterfaceFactory::class);
4747
}
4848

4949
/**
@@ -62,28 +62,17 @@ public function testUpdateQuoteRecollectAfterChangeProductPrice(): void
6262
$quoteItem = current($quote->getItems());
6363
$product = $quoteItem->getProduct();
6464

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]);
65+
$tierPrice = $this->tierPriceFactory->create();
66+
$tierPrice->setPrice($product->getPrice());
67+
$tierPrice->setPriceType('fixed');
68+
$tierPrice->setWebsiteId(0);
69+
$tierPrice->setSku($product->getSku());
70+
$tierPrice->setCustomerGroup('ALL GROUPS');
71+
$tierPrice->setQuantity(1);
72+
$this->tierPriceStorage->update([$tierPrice]);
7273

73-
/** @var QuoteResource $quoteResource */
74-
$quoteResource = $quote->getResource();
75-
/** @var AdapterInterface $connection */
76-
$connection = $quoteResource->getConnection();
77-
$select = $connection->select()
78-
->from(
79-
$quoteResource->getTable('quote'),
80-
['trigger_recollect']
81-
)->where(
82-
"reserved_order_id = 'test_order_with_simple_product_without_address'"
83-
);
84-
85-
$quoteRow = $connection->fetchRow($select);
86-
$this->assertNotEmpty($quoteRow);
87-
$this->assertTrue((bool)$quoteRow['trigger_recollect']);
74+
$quote = $this->getQuoteByReservedOrderId->execute($quoteId);
75+
$this->assertNotEmpty($quote->getTriggerRecollect());
76+
$this->assertTrue((bool)$quote->getTriggerRecollect());
8877
}
8978
}

0 commit comments

Comments
 (0)