Skip to content

Commit 7345f8d

Browse files
committed
ACP2E-1388:Bundle Products Not Combining Simple Product Prices When Set to Dynamic Pricing
adjusted solution for enabled "show out of stock items" option added unit test
1 parent edfca87 commit 7345f8d

File tree

4 files changed

+42
-287
lines changed

4 files changed

+42
-287
lines changed

app/code/Magento/Bundle/Model/Plugin/ProductPriceIndexModifier.php

Lines changed: 0 additions & 149 deletions
This file was deleted.

app/code/Magento/Bundle/Test/Unit/Model/Plugin/ProductPriceIndexModifierTest.php

Lines changed: 0 additions & 135 deletions
This file was deleted.

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Bundle\Pricing\Price\BundleSelectionFactory;
1616
use Magento\Catalog\Helper\Data as CatalogData;
1717
use Magento\Catalog\Model\Product;
18+
use Magento\Framework\Data\Collection\EntityFactoryInterface;
1819
use Magento\Framework\DataObject;
1920
use Magento\Store\Api\Data\StoreInterface;
2021
use Magento\Store\Api\Data\WebsiteInterface;
@@ -177,7 +178,48 @@ public function testGetPriceList(): void
177178
$this->selectionCollection->expects($this->once())
178179
->method('getIterator')
179180
->willReturn(new \ArrayIterator([]));
181+
$this->selectionCollection->expects($this->once())
182+
->method('setFlag')
183+
->with('has_stock_status_filter', true);
180184

181185
$this->model->getPriceList($this->product, false, false);
182186
}
187+
188+
public function testGetPriceListWithSearchMin(): void
189+
{
190+
$option = $this->createMock(Option::class);
191+
$option->expects($this->once())->method('getRequired')
192+
->willReturn(true);
193+
$this->optionsCollection->expects($this->any())
194+
->method('getIterator')
195+
->willReturn(new \ArrayIterator([$option]));
196+
$this->typeInstance->expects($this->any())
197+
->method('getOptionsCollection')
198+
->with($this->product)
199+
->willReturn($this->optionsCollection);
200+
$this->product->expects($this->any())
201+
->method('getTypeInstance')
202+
->willReturn($this->typeInstance);
203+
$this->selectionCollection->expects($this->once())
204+
->method('getFirstItem')
205+
->willReturn($this->createMock(Product::class));
206+
$this->typeInstance->expects($this->once())
207+
->method('getSelectionsCollection')
208+
->willReturn($this->selectionCollection);
209+
$this->selectionCollection->expects($this->once())
210+
->method('setFlag')
211+
->with('has_stock_status_filter', true);
212+
$this->selectionCollection->expects($this->once())
213+
->method('addQuantityFilter');
214+
$this->product->expects($this->once())->method('isSalable')->willReturn(true);
215+
$this->optionsCollection->expects($this->once())
216+
->method('getSize')
217+
->willReturn(1);
218+
$this->optionsCollection->expects($this->once())
219+
->method('addFilter')
220+
->willReturn($this->optionsCollection);
221+
222+
$this->model->getPriceList($this->product, true, false);
223+
}
183224
}
225+

app/code/Magento/Bundle/etc/di.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@
9696
<type name="Magento\Sales\Model\Order\Item">
9797
<plugin name="bundle" type="Magento\Bundle\Model\Sales\Order\Plugin\Item" sortOrder="100" />
9898
</type>
99-
<type name="Magento\CatalogInventory\Model\Indexer\ProductPriceIndexFilter">
100-
<plugin name="price_modifier" type="Magento\Bundle\Model\Plugin\ProductPriceIndexModifier" sortOrder="100" />
101-
</type>
10299
<type name="Magento\Framework\EntityManager\Operation\ExtensionPool">
103100
<arguments>
104101
<argument name="extensionActions" xsi:type="array">

0 commit comments

Comments
 (0)