Skip to content

Commit 6ee48e4

Browse files
Roman HaninRoman Hanin
authored andcommitted
B2B-2243: Optimize addProductsToCart operations
1 parent e447a88 commit 6ee48e4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ public function testAddProductItemPreparation(): void
10251025

10261026
$productMock = $this->getMockBuilder(Product::class)
10271027
->addMethods(['getParentProductId', 'setStickWithinParent'])
1028-
->onlyMethods(['__wakeup'])
1028+
->onlyMethods(['__wakeup', 'getId'])
10291029
->disableOriginalConstructor()
10301030
->getMock();
10311031

@@ -1043,6 +1043,15 @@ public function testAddProductItemPreparation(): void
10431043
->method('getIterator')
10441044
->willReturn($iterator);
10451045

1046+
$productMock->expects($this->any())
1047+
->method('getId')
1048+
->willReturn(123);
1049+
1050+
$collectionMock->expects($this->any())
1051+
->method('getItemByColumnValue')
1052+
->with('product_id', 123)
1053+
->willReturn($itemMock);
1054+
10461055
$this->quoteItemCollectionFactoryMock->expects($this->once())
10471056
->method('create')
10481057
->willReturn($collectionMock);

0 commit comments

Comments
 (0)