Skip to content

Commit dea780c

Browse files
committed
MC-41810: Cannot add bundle product with more than 1 checkbox option to the cart via Graphql
1 parent 412ee8d commit dea780c

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ public function testPrepareForCartAdvancedWithShoppingCart()
342342
'getData',
343343
'getQty',
344344
'getBundleOption',
345-
'getBundleOptionQty'
345+
'getBundleOptionQty',
346+
'getBundleOptionsData',
346347
]
347348
)
348349
->disableOriginalConstructor()
@@ -496,7 +497,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
496497
$selection->expects($this->once())
497498
->method('getSelectionCanChangeQty')
498499
->willReturn(true);
499-
$selection->expects($this->once())
500+
$selection->expects($this->exactly(2))
500501
->method('getSelectionId');
501502
$selection->expects($this->once())
502503
->method('addCustomOption')
@@ -531,9 +532,9 @@ function ($key) use ($optionCollection, $selectionCollection) {
531532

532533
$this->arrayUtility->expects($this->once())->method('flatten')->willReturn($bundleOptions);
533534

534-
$buyRequest->expects($this->once())
535-
->method('getBundleOptionQty')
536-
->willReturn([3 => 5]);
535+
$buyRequest->expects($this->exactly(2))
536+
->method('getBundleOptionsData')
537+
->willReturn([3 => [3 => 5]]);
537538
$priceModel->expects($this->once())
538539
->method('getSelectionFinalTotalPrice')
539540
->willReturnSelf();
@@ -586,7 +587,8 @@ public function testPrepareForCartAdvancedEmptyShoppingCart()
586587
'getData',
587588
'getQty',
588589
'getBundleOption',
589-
'getBundleOptionQty'
590+
'getBundleOptionQty',
591+
'getBundleOptionsData',
590592
]
591593
)
592594
->disableOriginalConstructor()
@@ -736,7 +738,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
736738
$selection->expects($this->once())
737739
->method('getSelectionCanChangeQty')
738740
->willReturn(true);
739-
$selection->expects($this->once())
741+
$selection->expects($this->exactly(2))
740742
->method('getSelectionId');
741743
$selection->expects($this->once())
742744
->method('addCustomOption')
@@ -768,9 +770,9 @@ function ($key) use ($optionCollection, $selectionCollection) {
768770
$option->expects($this->once())
769771
->method('getTitle')
770772
->willReturn('Title for option');
771-
$buyRequest->expects($this->once())
772-
->method('getBundleOptionQty')
773-
->willReturn([3 => 5]);
773+
$buyRequest->expects($this->exactly(2))
774+
->method('getBundleOptionsData')
775+
->willReturn([3 => [3 => 5]]);
774776
$priceModel->expects($this->once())
775777
->method('getSelectionFinalTotalPrice')
776778
->willReturnSelf();
@@ -811,7 +813,8 @@ public function testPrepareForCartAdvancedStringInResult()
811813
'getData',
812814
'getQty',
813815
'getBundleOption',
814-
'getBundleOptionQty'
816+
'getBundleOptionQty',
817+
'getBundleOptionsData',
815818
]
816819
)
817820
->disableOriginalConstructor()
@@ -957,7 +960,7 @@ function ($key) use ($optionCollection, $selectionCollection) {
957960
$selection->expects($this->once())
958961
->method('getSelectionCanChangeQty')
959962
->willReturn(true);
960-
$selection->expects($this->once())
963+
$selection->expects($this->exactly(2))
961964
->method('getSelectionId');
962965
$selection->expects($this->once())
963966
->method('addCustomOption')
@@ -992,9 +995,9 @@ function ($key) use ($optionCollection, $selectionCollection) {
992995

993996
$this->arrayUtility->expects($this->once())->method('flatten')->willReturn($bundleOptions);
994997

995-
$buyRequest->expects($this->once())
996-
->method('getBundleOptionQty')
997-
->willReturn([3 => 5]);
998+
$buyRequest->expects($this->exactly(2))
999+
->method('getBundleOptionsData')
1000+
->willReturn([3 => [3 => 5]]);
9981001
$priceModel->expects($this->once())
9991002
->method('getSelectionFinalTotalPrice')
10001003
->willReturnSelf();
@@ -1030,7 +1033,8 @@ public function testPrepareForCartAdvancedWithoutSelections()
10301033
'getData',
10311034
'getQty',
10321035
'getBundleOption',
1033-
'getBundleOptionQty'
1036+
'getBundleOptionQty',
1037+
'getBundleOptionsData',
10341038
]
10351039
)
10361040
->disableOriginalConstructor()
@@ -1105,9 +1109,9 @@ function ($key) use ($optionCollection) {
11051109

11061110
$bundleOptions = [];
11071111
$buyRequest->expects($this->once())->method('getBundleOption')->willReturn($bundleOptions);
1108-
$buyRequest->expects($this->once())
1109-
->method('getBundleOptionQty')
1110-
->willReturn([3 => 5]);
1112+
$buyRequest->expects($this->exactly(2))
1113+
->method('getBundleOptionsData')
1114+
->willReturn([3 => [3 => 5]]);
11111115

11121116
$this->arrayUtility->expects($this->once())->method('flatten')->willReturn($bundleOptions);
11131117

0 commit comments

Comments
 (0)