Skip to content

Commit 615b995

Browse files
committed
MAGETWO-61164: [Backport] - Configurable Product visible on the Category when options are Out of Stock and Disabled - for 2.1
1 parent b8a8cc7 commit 615b995

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
lines changed

dev/tests/integration/testsuite/Magento/Framework/Search/_files/product_configurable.php

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -109,35 +109,12 @@
109109

110110
$product->setExtensionAttributes($extensionConfigurableAttributes);
111111

112-
// Remove any previously created product with the same id.
113-
/** @var \Magento\Framework\Registry $registry */
114-
$registry = Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
115-
$registry->unregister('isSecureArea');
116-
$registry->register('isSecureArea', true);
117-
118-
try {
119-
$productToDelete = $productRepository->getById(10001);
120-
$productRepository->delete($productToDelete);
121-
122-
/** @var \Magento\Quote\Model\ResourceModel\Quote\Item $itemResource */
123-
$itemResource = Bootstrap::getObjectManager()->get(\Magento\Quote\Model\ResourceModel\Quote\Item::class);
124-
$itemResource->getConnection()->delete(
125-
$itemResource->getMainTable(),
126-
'product_id = ' . $productToDelete->getId()
127-
);
128-
} catch (\Exception $e) {
129-
// Nothing to remove
130-
}
131-
132-
$registry->unregister('isSecureArea');
133-
$registry->register('isSecureArea', false);
134-
135112
$product->setTypeId(Configurable::TYPE_CODE)
136113
->setId(1001)
137114
->setAttributeSetId($attributeSetId)
138115
->setWebsiteIds([1])
139116
->setName('Configurable Product')
140-
->setSku('configurable_searchable')
117+
->setSku('configurable')
141118
->setVisibility(Visibility::VISIBILITY_BOTH)
142119
->setStatus(Status::STATUS_ENABLED)
143120
->setStockData(['use_config_manage_stock' => 1, 'is_in_stock' => 1]);

dev/tests/integration/testsuite/Magento/Framework/Search/_files/product_configurable_rollback.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
88

99
/** @var \Magento\Framework\Registry $registry */
10-
$registry = $objectManager->get('Magento\Framework\Registry');
10+
$registry = $objectManager->get(\Magento\Framework\Registry::class);
1111

1212
$registry->unregister('isSecureArea');
1313
$registry->register('isSecureArea', true);
1414

1515
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
1616
$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
17-
->get('Magento\Catalog\Api\ProductRepositoryInterface');
17+
->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
1818

1919
foreach (['simple_1010', 'simple_1020', 'configurable'] as $sku) {
2020
try {
2121
$product = $productRepository->get($sku, false, null, true);
2222

23-
$stockStatus = $objectManager->create('Magento\CatalogInventory\Model\Stock\Status');
23+
$stockStatus = $objectManager->create(\Magento\CatalogInventory\Model\Stock\Status::class);
2424
$stockStatus->load($product->getEntityId(), 'product_id');
2525
$stockStatus->delete();
2626

0 commit comments

Comments
 (0)