Skip to content

Commit 95293ef

Browse files
committed
MAGETWO-92402: Write tests
1 parent 6145341 commit 95293ef

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/*
8+
* Since the bundle product creation GUI doesn't allow to choose values for bundled products' custom options,
9+
* bundled items should not contain products with required custom options.
10+
* However, if to create such a bundle product, it will be always out of stock.
11+
*/
12+
require __DIR__ . '/../../../Magento/Catalog/_files/products_rollback.php';
13+
14+
/** @var \Magento\Framework\Registry $registry */
15+
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
16+
17+
$registry->unregister('isSecureArea');
18+
$registry->register('isSecureArea', true);
19+
20+
try {
21+
$product = $productRepository->get('bundle-product');
22+
$productRepository->delete($product);
23+
} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
24+
//Product already removed
25+
}
26+
27+
$registry->unregister('isSecureArea');
28+
$registry->register('isSecureArea', false);

dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_bundle_product.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
/** @var $cart \Magento\Checkout\Model\Cart */
3636
$cart = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Checkout\Model\Cart::class);
3737
$cart->addProduct($product, $requestInfo);
38+
$cart->getQuote()->setReservedOrderId('test_cart_with_bundle');
3839
$cart->save();
3940

4041
/** @var $objectManager \Magento\TestFramework\ObjectManager */

dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_bundle_product_rollback.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
//Product already removed
2626
}
2727

28-
//TODO: remove created cart info
28+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
29+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
30+
$quote = $objectManager->create(\Magento\Quote\Model\Quote::class);
31+
$quote->load('test_cart_with_bundle', 'reserved_order_id');
32+
$quote->delete();
2933

3034
$registry->unregister('isSecureArea');
3135
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)