Skip to content

Commit ad90ed2

Browse files
committed
magento/graphql-ce#808: [Test coverage] Add disabled variation of Configurable Product to cart
1 parent 09ded14 commit ad90ed2

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed

dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
use Magento\TestFramework\Helper\Bootstrap;
1414

1515
$childSku = 'simple_10';
16-
try {
17-
$childProduct = $productRepository->get($childSku);
18-
$productAction = Bootstrap::getObjectManager()->get(Action::class);
19-
$productAction->updateAttributes(
20-
[$childProduct->getEntityId()],
21-
[ProductAttributeInterface::CODE_STATUS => Status::STATUS_DISABLED],
22-
$childProduct->getStoreId()
23-
);
24-
} catch (Exception $e) {
25-
// Nothing to remove
26-
}
16+
17+
$childProduct = $productRepository->get($childSku);
18+
$productAction = Bootstrap::getObjectManager()->get(Action::class);
19+
$productAction->updateAttributes(
20+
[$childProduct->getEntityId()],
21+
[ProductAttributeInterface::CODE_STATUS => Status::STATUS_DISABLED],
22+
$childProduct->getStoreId()
23+
);

dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88
require __DIR__ . '/product_configurable_sku.php';
99

1010
$childSku = 'simple_10';
11-
try {
12-
$childProduct = $productRepository->get($childSku);
13-
$childProduct->setStockData(
14-
[
15-
'use_config_manage_stock' => 1,
16-
'qty' => 0,
17-
'is_qty_decimal' => 0,
18-
'is_in_stock' => 0
19-
]
20-
);
21-
$productRepository->save($childProduct);
22-
} catch (Exception $e) {
23-
// Nothing to remove
24-
}
11+
12+
$childProduct = $productRepository->get($childSku);
13+
$childProduct->setStockData(
14+
[
15+
'use_config_manage_stock' => 1,
16+
'qty' => 0,
17+
'is_qty_decimal' => 0,
18+
'is_in_stock' => 0
19+
]
20+
);
21+
$productRepository->save($childProduct);

0 commit comments

Comments
 (0)