Skip to content

Commit 7f727a0

Browse files
committed
Merge remote-tracking branch 'origin/ACP2E-286' into L3_Arrows_PR_20220314
2 parents 5630fc0 + 418ba2d commit 7f727a0

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

app/code/Magento/Reports/Controller/Adminhtml/Report/Shopcart/ExportAbandonedCsv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function execute()
2828
$fileName = 'shopcart_abandoned.csv';
2929
$content = $this->_view->getLayout()->createBlock(
3030
\Magento\Reports\Block\Adminhtml\Shopcart\Abandoned\Grid::class
31-
)->getCsvFile();
31+
)->getCsv();
3232

3333
return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
3434
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Shopcart;
9+
10+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
11+
use Magento\Reports\Block\Adminhtml\Shopcart\Abandoned\Grid;
12+
use Magento\Reports\Controller\Adminhtml\Report\Shopcart\ExportAbandonedCsv;
13+
use Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest;
14+
15+
class ExportAbandonedCsvTest extends AbstractControllerTest
16+
{
17+
/**
18+
* @var ExportAbandonedCsv
19+
*/
20+
protected $exportAbandonedCsv;
21+
22+
/**
23+
* {@inheritDoc}
24+
*/
25+
protected function setUp(): void
26+
{
27+
parent::setUp();
28+
29+
$objectManager = new ObjectManager($this);
30+
$this->exportAbandonedCsv = $objectManager->getObject(
31+
ExportAbandonedCsv::class,
32+
[
33+
'context' => $this->contextMock,
34+
'fileFactory' => $this->fileFactoryMock,
35+
]
36+
);
37+
}
38+
39+
/**
40+
* @return void
41+
*/
42+
public function testExecute()
43+
{
44+
$content = ['export'];
45+
46+
$this->abstractBlockMock
47+
->expects($this->once())
48+
->method('getCsv')
49+
->willReturn($content);
50+
51+
$this->layoutMock
52+
->expects($this->once())
53+
->method('createBlock')
54+
->with(Grid::class)
55+
->willReturn($this->abstractBlockMock);
56+
57+
$this->fileFactoryMock
58+
->expects($this->once())
59+
->method('create')
60+
->with('shopcart_abandoned.csv', $content);
61+
62+
$this->exportAbandonedCsv->execute();
63+
}
64+
}

0 commit comments

Comments
 (0)