Skip to content

Commit eb6eed2

Browse files
committed
Merge branch 'ACP2E-2034' of https://github.com/magento-l3/magento2ce into L3-PR-2023-06-23
2 parents 13e54e1 + b95278d commit eb6eed2

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

app/code/Magento/Bundle/Pricing/Adjustment/DefaultSelectionPriceListProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ public function getPriceList(Product $bundleProduct, $searchMin, $useRegularPric
8585
[(int)$option->getOptionId()],
8686
$bundleProduct
8787
);
88-
$selectionsCollection->setFlag('has_stock_status_filter', true);
88+
89+
if ((int)$bundleProduct->getPriceType() !== Price::PRICE_TYPE_FIXED) {
90+
$selectionsCollection->setFlag('has_stock_status_filter', true);
91+
}
8992
$selectionsCollection->removeAttributeToSelect();
9093

9194
if (!$useRegularPrice) {

app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/DefaultSelectionPriceListProviderTest.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Bundle\Test\Unit\Pricing\Adjustment;
99

1010
use Magento\Bundle\Model\Option;
11+
use Magento\Bundle\Model\Product\Price;
1112
use Magento\Bundle\Model\Product\Type;
1213
use Magento\Bundle\Model\ResourceModel\Option\Collection;
1314
use Magento\Bundle\Model\ResourceModel\Selection\Collection as SelectionCollection;
@@ -109,6 +110,8 @@ protected function setUp(): void
109110

110111
$this->product = $this->getMockBuilder(Product::class)
111112
->disableOriginalConstructor()
113+
->addMethods(['getPriceType'])
114+
->onlyMethods(['getTypeInstance', 'isSalable'])
112115
->getMock();
113116
$this->optionsCollection = $this->getMockBuilder(Collection::class)
114117
->disableOriginalConstructor()
@@ -142,6 +145,54 @@ public function testGetPriceList(): void
142145
{
143146
$optionId = 1;
144147

148+
$this->typeInstance->expects($this->any())
149+
->method('getOptionsCollection')
150+
->with($this->product)
151+
->willReturn($this->optionsCollection);
152+
$this->product->expects($this->any())
153+
->method('getTypeInstance')
154+
->willReturn($this->typeInstance);
155+
$this->product->expects($this->once())
156+
->method('getPriceType')->willReturn(Price::PRICE_TYPE_FIXED);
157+
$this->optionsCollection->expects($this->once())
158+
->method('getIterator')
159+
->willReturn(new \ArrayIterator([$this->option]));
160+
$this->option->expects($this->once())
161+
->method('getOptionId')
162+
->willReturn($optionId);
163+
$this->typeInstance->expects($this->once())
164+
->method('getSelectionsCollection')
165+
->with([$optionId], $this->product)
166+
->willReturn($this->selectionCollection);
167+
$this->option->expects($this->once())
168+
->method('isMultiSelection')
169+
->willReturn(true);
170+
$this->storeManager->expects($this->once())
171+
->method('getStore')
172+
->willReturn($this->store);
173+
$this->store->expects($this->once())
174+
->method('getWebsiteId')
175+
->willReturn(0);
176+
$this->websiteRepository->expects($this->once())
177+
->method('getDefault')
178+
->willReturn($this->website);
179+
$this->website->expects($this->once())
180+
->method('getId')
181+
->willReturn(1);
182+
$this->selectionCollection->expects($this->once())
183+
->method('getIterator')
184+
->willReturn(new \ArrayIterator([]));
185+
$this->selectionCollection->expects($this->never())
186+
->method('setFlag')
187+
->with('has_stock_status_filter', true);
188+
189+
$this->model->getPriceList($this->product, false, false);
190+
}
191+
192+
public function testGetPriceListForFixedPriceType(): void
193+
{
194+
$optionId = 1;
195+
145196
$this->typeInstance->expects($this->any())
146197
->method('getOptionsCollection')
147198
->with($this->product)

0 commit comments

Comments
 (0)