Skip to content

Commit 96e1222

Browse files
committed
MAGETWO-86218: Enable Add to Cart on bundle products when bundle item qty is not User Defined while backorders are allowed
1 parent 952a8a9 commit 96e1222

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

dev/tests/integration/testsuite/Magento/Bundle/Model/ProductTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Magento\Catalog\Model\Product\Attribute\Source\Status;
1818
use Magento\Catalog\Model\Product\Type;
1919
use Magento\Catalog\Model\Product\Visibility;
20-
use Magento\CatalogInventory\Api\StockRegistryInterface;
2120
use Magento\CatalogInventory\Model\Stock;
2221
use Magento\Framework\ObjectManagerInterface;
2322
use Magento\Store\Api\StoreRepositoryInterface;
@@ -148,8 +147,6 @@ public function testIsSalable(
148147
bool $isSalable
149148
) {
150149
$productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
151-
/** @var \Magento\Catalog\Model\Product $bundle */
152-
$bundle = $productRepository->get('bundle-product');
153150

154151
$child = $productRepository->get('simple');
155152
$childStockItem = $child->getExtensionAttributes()->getStockItem();
@@ -161,15 +158,16 @@ public function testIsSalable(
161158
$childStockItem->setBackorders($backorders);
162159
$productRepository->save($child);
163160

164-
foreach ($bundle->getExtensionAttributes()->getBundleProductOptions() as $productOption) {
161+
$this->model->load(3);
162+
foreach ($this->model->getExtensionAttributes()->getBundleProductOptions() as $productOption) {
165163
foreach ($productOption->getProductLinks() as $productLink) {
166164
$productLink->setCanChangeQuantity(0);
167165
$productLink->setQty($selectionQty);
168166
}
169167
}
170-
$productRepository->save($bundle);
168+
$productRepository->save($this->model);
171169

172-
$this->assertEquals($isSalable, $bundle->isSalable());
170+
$this->assertEquals($isSalable, $this->model->isSalable());
173171
}
174172

175173
/**

0 commit comments

Comments
 (0)