Skip to content

Commit 8c8cc6d

Browse files
ACPT-1490: Covered customer with multiselect attribute json import with web-api test
1 parent 9a7db20 commit 8c8cc6d

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

dev/tests/integration/testsuite/Magento/Customer/_files/import_export/customers_rollback.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,29 @@
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');

0 commit comments

Comments
 (0)