Skip to content

Commit 994d8e5

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 96e1222 commit 994d8e5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
use Magento\TestFramework\Entity;
2525
use Magento\TestFramework\Helper\Bootstrap;
2626

27+
/**
28+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
29+
*/
2730
class ProductTest extends \PHPUnit\Framework\TestCase
2831
{
2932
/**
@@ -158,16 +161,17 @@ public function testIsSalable(
158161
$childStockItem->setBackorders($backorders);
159162
$productRepository->save($child);
160163

161-
$this->model->load(3);
162-
foreach ($this->model->getExtensionAttributes()->getBundleProductOptions() as $productOption) {
164+
/** @var \Magento\Catalog\Model\Product $bundle */
165+
$bundle = $productRepository->get('bundle-product');
166+
foreach ($bundle->getExtensionAttributes()->getBundleProductOptions() as $productOption) {
163167
foreach ($productOption->getProductLinks() as $productLink) {
164168
$productLink->setCanChangeQuantity(0);
165169
$productLink->setQty($selectionQty);
166170
}
167171
}
168-
$productRepository->save($this->model);
172+
$productRepository->save($bundle);
169173

170-
$this->assertEquals($isSalable, $this->model->isSalable());
174+
$this->assertEquals($isSalable, $bundle->isSalable());
171175
}
172176

173177
/**

0 commit comments

Comments
 (0)