Skip to content

Commit 2894aaa

Browse files
author
Valeriy Nayda
committed
GraphQL-57: Manage Address Book
-- Refactoring
1 parent f41405d commit 2894aaa

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Customer\Api\AddressRepositoryInterface;
9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Framework\Registry;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
13+
/** @var Registry $registry */
14+
$registry = Bootstrap::getObjectManager()->get(Registry::class);
15+
$registry->unregister('isSecureArea');
16+
$registry->register('isSecureArea', true);
17+
18+
/** @var AddressRepositoryInterface $addressRepository */
19+
$addressRepository = Bootstrap::getObjectManager()->get(AddressRepositoryInterface::class);
20+
21+
foreach ([1, 2] as $addressId) {
22+
try {
23+
$addressRepository->deleteById($addressId);
24+
} catch (NoSuchEntityException $e) {
25+
/**
26+
* Tests which are wrapped with MySQL transaction clear all data by transaction rollback.
27+
*/
28+
}
29+
}
30+
31+
$registry->unregister('isSecureArea');
32+
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)