Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
two_addresses_rollback.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
13 
14 //Clearing websites.
15 include __DIR__ . '/../../Store/_files/websites_different_countries_rollback.php';
16 
18 $registry = Bootstrap::getObjectManager()->get(Registry::class);
19 
20 //Removing customers.
21 $registry->unregister('isSecureArea');
22 $registry->register('isSecureArea', true);
24 $customer = Bootstrap::getObjectManager()->create(Customer::class);
25 $customer->load(1);
26 if ($customer->getId()) {
27  $customer->delete();
28 }
29 $registry->unregister('isSecureArea');
30 $registry->register('isSecureArea', false);
31 /* Unlock account if it was locked for tokens retrieval */
33 $throttler = Bootstrap::getObjectManager()->create(RequestThrottler::class);
34 $throttler->resetAuthenticationFailuresCount(
36  RequestThrottler::USER_TYPE_CUSTOMER
37 );
38 //Second customer.
39 $registry->unregister('isSecureArea');
40 $registry->register('isSecureArea', true);
42 $customer = Bootstrap::getObjectManager()->create(Customer::class);
43 $customer->load(2);
44 if ($customer->getId()) {
45  $customer->delete();
46 }
47 $registry->unregister('isSecureArea');
48 $registry->register('isSecureArea', false);
49 /* Unlock account if it was locked for tokens retrieval */
50 $throttler->resetAuthenticationFailuresCount(
52  RequestThrottler::USER_TYPE_CUSTOMER
53 );
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60