Skip to content

Commit 2299cf9

Browse files
committed
GraphQL-295: [Place order] Place order mutation
1 parent 61b4ec8 commit 2299cf9

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77

88
namespace Magento\GraphQl\Quote\Customer;
99

10+
use Magento\Framework\Exception\NoSuchEntityException;
11+
use Magento\Framework\Registry;
1012
use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId;
1113
use Magento\Integration\Api\CustomerTokenServiceInterface;
14+
use Magento\Sales\Api\OrderRepositoryInterface;
15+
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
1216
use Magento\TestFramework\Helper\Bootstrap;
1317
use Magento\TestFramework\TestCase\GraphQlAbstract;
1418

@@ -27,6 +31,21 @@ class PlaceOrderTest extends GraphQlAbstract
2731
*/
2832
private $getMaskedQuoteIdByReservedOrderId;
2933

34+
/**
35+
* @var CollectionFactory
36+
*/
37+
private $orderCollectionFactory;
38+
39+
/**
40+
* @var OrderRepositoryInterface
41+
*/
42+
private $orderRepository;
43+
44+
/**
45+
* @var Registry
46+
*/
47+
private $registry;
48+
3049
/**
3150
* @inheritdoc
3251
*/
@@ -35,6 +54,9 @@ protected function setUp()
3554
$objectManager = Bootstrap::getObjectManager();
3655
$this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
3756
$this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
57+
$this->orderCollectionFactory = $objectManager->get(CollectionFactory::class);
58+
$this->orderRepository = $objectManager->get(OrderRepositoryInterface::class);
59+
$this->registry = Bootstrap::getObjectManager()->get(Registry::class);
3860
}
3961

4062
/**
@@ -253,4 +275,22 @@ private function getHeaderMap(string $username = '[email protected]', string
253275
$headerMap = ['Authorization' => 'Bearer ' . $customerToken];
254276
return $headerMap;
255277
}
278+
279+
/**
280+
* @inheritdoc
281+
*/
282+
public function tearDown()
283+
{
284+
$this->registry->unregister('isSecureArea');
285+
$this->registry->register('isSecureArea', true);
286+
287+
$orderCollection = $this->orderCollectionFactory->create();
288+
foreach ($orderCollection as $order) {
289+
$this->orderRepository->delete($order);
290+
}
291+
$this->registry->unregister('isSecureArea');
292+
$this->registry->register('isSecureArea', false);
293+
294+
parent::tearDown();
295+
}
256296
}

0 commit comments

Comments
 (0)