File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
dev/tests/integration/testsuite/Magento/Customer/_files/import_export Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 2121/** @var $customer Customer */
2222$ customer = $ objectManager ->create (Customer::class);
2323
24- $ emailsToDelete = [
24+ $ customersToRemove = [
2525 'customer@example.com ' ,
2626 'julie.worrell@example.com ' ,
2727 'david.lamar@example.com ' ,
2828];
29- foreach ($ emailsToDelete as $ email ) {
29+
30+ /**
31+ * @var Magento\Customer\Api\CustomerRepositoryInterface
32+ */
33+ $ customerRepository = $ objectManager ->create (\Magento \Customer \Api \CustomerRepositoryInterface::class);
34+
35+ foreach ($ customersToRemove as $ customerEmail ) {
3036 try {
31- $ customer ->loadByEmail ($ email )->delete ();
32- } catch (\Exception $ e ) {
37+ $ customer = $ customerRepository ->get ($ customerEmail );
38+ $ customerRepository ->delete ($ customer );
39+ } catch (\Magento \Framework \Exception \NoSuchEntityException $ exception ) {
40+ /**
41+ * Tests which are wrapped with MySQL transaction clear all data by transaction rollback.
42+ */
43+ continue ;
3344 }
3445}
46+
3547$ registry ->unregister ('isSecureArea ' );
3648$ registry ->register ('isSecureArea ' , false );
3749$ registry ->unregister ('_fixture/Magento_ImportExport_Customer_Collection ' );
You can’t perform that action at this time.
0 commit comments