29 $this->productRepository = $this->objectManager->get(\
Magento\Catalog\Api\ProductRepositoryInterface::class);
45 'Bundle product supposed to be saleable 46 if his status is enabled' 63 'Bundle product supposed to be non saleable 64 if his status is disabled' 83 'Bundle product supposed to be saleable 84 if his status is enabled and it has data is_salable = true' 103 'Bundle product supposed to be non saleable 104 if his status is enabled but his data is_salable = false' 121 'Bundle product supposed to be saleable 122 if it has data all_items_salable = true' 139 'Bundle product supposed to be non saleable 140 if it has data all_items_salable = false' 152 $optionRepository = $this->objectManager->create(\
Magento\Bundle\Api\ProductOptionRepositoryInterface::class);
157 foreach ($ea->getBundleProductOptions() as
$option) {
158 $optionRepository->delete(
$option);
160 $ea->setBundleProductOptions([]);
167 'Bundle product supposed to be non saleable 168 if it has no options' 178 public function testIsSaleableOnBundleWithoutSelections()
180 $bundleProduct = $this->productRepository->get(
'bundle-product',
true,
null,
true);
183 $linkManager = $this->objectManager->create(\
Magento\Bundle\Model\LinkManagement::class);
189 foreach ($selections as
$link) {
191 $linkManager->removeChild(
'bundle-product',
$link->getOptionId(),
$link->getSku());
194 $bundleProduct = $this->productRepository->get(
'bundle-product',
false,
null,
true);
197 'Bundle product supposed to be non saleable 198 if it has no selections' 211 $productsSku = [
'simple1',
'simple2',
'simple3',
'simple4',
'simple5'];
213 $product = $this->productRepository->get($productSku);
215 $this->productRepository->save(
$product);
222 'Bundle product supposed to be non saleable 223 if all his selections are not saleable' 238 $product = $this->productRepository->get($productSku);
240 $this->productRepository->save(
$product);
247 'Bundle product supposed to be non saleable 248 if it has at least one required option with no saleable selections' 261 $this->setQtyForSelections([
'simple1',
'simple2',
'simple3'], 1);
267 'Bundle product supposed to be non saleable 268 if there are not enough qty of selections on required options' 281 $this->setQtyForSelections([
'simple1',
'simple2',
'simple3',
'simple4',
'simple5'], 1);
288 $link->setSelectionCanChangeQuantity(1);
302 'Bundle product supposed to be saleable 303 if all his selections have selection_can_change_qty = 1' 317 $productsSku = [
'simple1',
'simple2',
'simple3',
'simple4',
'simple5'];
319 $product = $this->productRepository->get($productSku);
321 $this->productRepository->save(
$product);
339 'Bundle product supposed to be not saleable 340 if all his options are not required and selections are not saleable' 354 $productsSku = [
'simple1',
'simple2',
'simple4',
'simple5'];
357 $product = $this->productRepository->get($productSku);
359 $this->productRepository->save(
$product);
378 'Bundle product supposed to be saleable 379 if it has at least one not required option with saleable selection' 383 private function setQtyForSelections(
$productsSku, $qty)
386 $product = $this->productRepository->get($productSku);
387 $ea =
$product->getExtensionAttributes();
388 $ea->getStockItem()->setQty($qty);
389 $this->productRepository->save(
$product);
testIsSaleableOnBundleWithoutSaleableSelectionsOnRequiredOption()
testIsSaleableOnBundleWithSelectionCanChangeQty()
testIsSaleableOnDisabledStatus()
testIsSaleableOnEnabledStatusAndIsSalableIsFalse()
testIsSaleableOnBundleWithOneSaleableSelection()
testIsSaleableOnBundleWithoutOptions()
testIsSaleableOnBundleWithNotEnoughQtyOfSelection()
testIsSaleableOnAllItemsSalableIsFalse()
testIsSaleableOnBundleWithoutSaleableSelections()
testIsSaleableOnEnabledStatusAndIsSalableIsTrue()
testIsSaleableOnAllItemsSalableIsTrue()
testIsSaleableOnEnabledStatus()
testIsSaleableOnBundleWithoutRequiredOptions()
static getObjectManager()