Skip to content

Commit 668e312

Browse files
committed
ACP2E-3813: Updating products using the Mass Action, resulted in an unexpected system logout
1 parent f098626 commit 668e312

File tree

1 file changed

+26
-6
lines changed
  • dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import

1 file changed

+26
-6
lines changed

dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
use Magento\Customer\Api\CustomerRepositoryInterface;
1010
use Magento\Customer\Api\Data\CustomerInterface;
1111
use Magento\Customer\Model\Indexer\Processor;
12+
use Magento\Customer\Model\ResourceModel\Customer\Collection as CustomerCollection;
1213
use Magento\Framework\App\Filesystem\DirectoryList;
1314
use Magento\Framework\Exception\NoSuchEntityException;
1415
use Magento\Framework\Filesystem\Directory\Write as DirectoryWrite;
1516
use Magento\Framework\Filesystem\File\WriteFactory;
1617
use Magento\Framework\Indexer\StateInterface;
1718
use Magento\Framework\ObjectManagerInterface;
19+
use Magento\Framework\Registry;
1820
use Magento\ImportExport\Model\Import;
1921
use Magento\ImportExport\Model\Import\Source\CsvFactory;
2022
use Magento\TestFramework\Helper\Bootstrap;
@@ -95,6 +97,24 @@ protected function setUp(): void
9597
$this->csvFactory = $this->objectManager->get(CsvFactory::class);
9698
}
9799

100+
/**
101+
* @inheritdoc
102+
*/
103+
protected function tearDown(): void
104+
{
105+
$registry = $this->objectManager->get(Registry::class);
106+
$registry->unregister('isSecureArea');
107+
$registry->register('isSecureArea', true);
108+
try {
109+
$customerCollection = $this->objectManager->create(CustomerCollection::class);
110+
$customerCollection->delete();
111+
} finally {
112+
$registry->unregister('isSecureArea');
113+
$registry->register('isSecureArea', false);
114+
}
115+
parent::tearDown();
116+
}
117+
98118
/**
99119
* Test importData() method
100120
*
@@ -113,9 +133,9 @@ public function testImportData()
113133

114134
$existingCustomer = $this->getCustomer('[email protected]', 1);
115135

116-
/** @var $customersCollection \Magento\Customer\Model\ResourceModel\Customer\Collection */
136+
/** @var $customersCollection CustomerCollection */
117137
$customersCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
118-
\Magento\Customer\Model\ResourceModel\Customer\Collection::class
138+
CustomerCollection::class
119139
);
120140
$customersCollection->addAttributeToSelect('firstname', 'inner')->addAttributeToSelect('lastname', 'inner');
121141

@@ -276,9 +296,9 @@ public function testImportDataWithOneAdditionalColumn(): void
276296
$existingCustomer->setWebsiteId(1);
277297
$existingCustomer = $existingCustomer->loadByEmail('[email protected]');
278298

279-
/** @var $customersCollection \Magento\Customer\Model\ResourceModel\Customer\Collection */
299+
/** @var $customersCollection CustomerCollection */
280300
$customersCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
281-
\Magento\Customer\Model\ResourceModel\Customer\Collection::class
301+
CustomerCollection::class
282302
);
283303
$customersCollection->resetData();
284304
$customersCollection->clear();
@@ -346,9 +366,9 @@ public function testDeleteData()
346366
$this->directoryWrite
347367
);
348368

349-
/** @var $customerCollection \Magento\Customer\Model\ResourceModel\Customer\Collection */
369+
/** @var $customerCollection CustomerCollection */
350370
$customerCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
351-
\Magento\Customer\Model\ResourceModel\Customer\Collection::class
371+
CustomerCollection::class
352372
);
353373
$this->assertEquals(3, $customerCollection->count(), 'Count of existing customers are invalid');
354374

0 commit comments

Comments
 (0)