Skip to content

Commit 5f49f4e

Browse files
committed
test coverage
1 parent b202840 commit 5f49f4e

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

app/code/Magento/Reports/Model/ResourceModel/Quote/Collection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ public function resolveCustomerNames()
200200
foreach ($this->getItems() as $item) {
201201
foreach ($customersData as $customerItemData) {
202202
if ($item['customer_id'] == $customerItemData['entity_id']) {
203-
$item['customer_name'] = $customerItemData['customer_name'];
204-
$item['email'] = $customerItemData['email'];
203+
$item->setData('customer_name', $customerItemData['customer_name']);
204+
$item->setData('email', $customerItemData['email']);
205205
$item->setData($item->getData());
206206
}
207207
}
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('getCsvFile')
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)