Skip to content

Commit 3f13021

Browse files
Roman HaninRoman Hanin
authored andcommitted
B2B-2423: Optimize addProductsToCart operations
- CR fixes
1 parent ff82676 commit 3f13021

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,9 +1048,9 @@ public function testAddProductItemPreparation(): void
10481048
->willReturn(123);
10491049

10501050
$collectionMock->expects($this->any())
1051-
->method('getItemByColumnValue')
1051+
->method('getItemsByColumnValue')
10521052
->with('product_id', 123)
1053-
->willReturn($itemMock);
1053+
->willReturn([$itemMock]);
10541054

10551055
$this->quoteItemCollectionFactoryMock->expects($this->once())
10561056
->method('create')
@@ -1096,7 +1096,7 @@ public function testAddProductItemNew(): void
10961096

10971097
$productMock = $this->getMockBuilder(Product::class)
10981098
->addMethods(['getParentProductId', 'setStickWithinParent'])
1099-
->onlyMethods(['__wakeup'])
1099+
->onlyMethods(['__wakeup', 'getId'])
11001100
->disableOriginalConstructor()
11011101
->getMock();
11021102

@@ -1111,6 +1111,15 @@ public function testAddProductItemNew(): void
11111111
->method('getIterator')
11121112
->willReturn($iterator);
11131113

1114+
$productMock->expects($this->any())
1115+
->method('getId')
1116+
->willReturn(123);
1117+
1118+
$collectionMock->expects($this->any())
1119+
->method('getItemsByColumnValue')
1120+
->with('product_id', 123)
1121+
->willReturn([$itemMock]);
1122+
11141123
$this->quoteItemCollectionFactoryMock->expects($this->once())
11151124
->method('create')
11161125
->willReturn($collectionMock);

0 commit comments

Comments
 (0)