Skip to content

Commit a345343

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 6b4b959 commit a345343

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,9 @@ class ProductTest extends \PHPUnit\Framework\TestCase
3737
*/
3838
private $objectManager;
3939

40-
/**
41-
* @var ProductRepositoryInterface
42-
*/
43-
private $productRepository;
44-
4540
protected function setUp()
4641
{
4742
$this->objectManager = Bootstrap::getObjectManager();
48-
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
4943

5044
$this->model = $this->objectManager->create(Product::class);
5145
$this->model->setTypeId(Type::TYPE_BUNDLE);
@@ -112,7 +106,9 @@ public function testIsComposite()
112106
*/
113107
public function testMultipleStores()
114108
{
115-
$bundle = $this->productRepository->get('bundle-product');
109+
/** @var ProductRepositoryInterface $productRepository */
110+
$productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
111+
$bundle = $productRepository->get('bundle-product');
116112

117113
/** @var StoreRepositoryInterface $storeRepository */
118114
$storeRepository = $this->objectManager->get(StoreRepositoryInterface::class);
@@ -126,7 +122,7 @@ public function testMultipleStores()
126122

127123
$bundle->setStoreId($store->getId())
128124
->setCopyFromView(true);
129-
$updatedBundle = $this->productRepository->save($bundle);
125+
$updatedBundle = $productRepository->save($bundle);
130126

131127
self::assertEquals($store->getId(), $updatedBundle->getStoreId());
132128
}
@@ -151,10 +147,11 @@ public function testIsSalable(
151147
int $backorders,
152148
bool $isSalable
153149
) {
150+
$productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
154151
/** @var \Magento\Catalog\Model\Product $bundle */
155-
$bundle = $this->productRepository->get('bundle-product');
152+
$bundle = $productRepository->get('bundle-product');
156153

157-
$child = $this->productRepository->get('simple');
154+
$child = $productRepository->get('simple');
158155
$stockRegistry = $this->objectManager->get(StockRegistryInterface::class);
159156
$childStockItem = $stockRegistry->getStockItem($child->getId());
160157
$childStockItem->setQty($qty);
@@ -171,7 +168,6 @@ public function testIsSalable(
171168
$productLink->setCanChangeQuantity(0);
172169
$productLink->setQty($selectionQty);
173170
$linkManagement->saveChild($bundle->getSku(), $productLink);
174-
175171
}
176172
}
177173

0 commit comments

Comments
 (0)