Skip to content

Commit 91d0a2d

Browse files
committed
Merge remote-tracking branch 'origin/AC-14266' into spartans_pr_02122025
2 parents 9bcd880 + b05bf27 commit 91d0a2d

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

app/code/Magento/ImportExport/Controller/Adminhtml/Import/Start.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function execute()
124124

125125
$this->addErrorMessages($resultBlock, $errorAggregator);
126126
$resultBlock->addSuccess(__('Import successfully done'));
127+
$this->_eventManager->dispatch('log_admin_import');
127128
}
128129

129130
return $resultLayout;

app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function execute()
5151
$import = $this->getImport()->setData($data);
5252
try {
5353
$source = $import->uploadFileAndGetSource();
54+
$this->_eventManager->dispatch('log_admin_import');
5455
$this->processValidationResult($import->validateSource($source), $resultBlock);
5556
$ids = $import->getValidatedIds();
5657
if (count($ids) > 0) {

app/code/Magento/ImportExport/Test/Unit/Controller/Adminhtml/Import/ValidateTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use Magento\ImportExport\Model\Import;
2828
use Magento\ImportExport\Model\Import\AbstractSource;
2929
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
30+
use Magento\Framework\Event\ManagerInterface as EventManagerInterface;
3031

3132
/**
3233
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -83,6 +84,11 @@ class ValidateTest extends TestCase
8384
*/
8485
private $abstractSourceMock;
8586

87+
/**
88+
* @var EventManagerInterface|MockObject
89+
*/
90+
private $eventManagerMock;
91+
8692
protected function setUp(): void
8793
{
8894
$objectManagerHelper = new ObjectManagerHelper($this);
@@ -147,6 +153,13 @@ protected function setUp(): void
147153
->disableOriginalConstructor()
148154
->getMockForAbstractClass();
149155

156+
$this->eventManagerMock = $this->getMockBuilder(EventManagerInterface::class)
157+
->getMockForAbstractClass();
158+
159+
$this->contextMock->expects($this->any())
160+
->method('getEventManager')
161+
->willReturn($this->eventManagerMock);
162+
150163
$this->validate = new Validate(
151164
$this->contextMock,
152165
$this->reportProcessorMock,
@@ -337,6 +350,10 @@ public function testFileVerifiedWithImport()
337350
->method('getAllErrors')
338351
->willReturn($errorAggregatorMock);
339352

353+
$this->eventManagerMock->expects($this->once())
354+
->method('dispatch')
355+
->with('log_admin_import');
356+
340357
$this->resultFactoryMock->expects($this->any())
341358
->method('create')
342359
->with(ResultFactory::TYPE_LAYOUT)

0 commit comments

Comments
 (0)