Skip to content

Commit 9368d5d

Browse files
Merge forwardport of #12241 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/12241.patch (created by @RomaKis) based on commit(s): 1. ef165a2 2. f11c0db 3. 1ebcd7a 4. a933cf7 5. f8ed60f Fixed GitHub Issues in 2.3-develop branch: - #10128: New Orders not being saved to order grid (reported by @joergmaertin)
2 parents 058e5e5 + 742819b commit 9368d5d

File tree

2 files changed

+45
-1
lines changed
  • app/code/Magento/Backend/Block/Dashboard/Orders
  • dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders

2 files changed

+45
-1
lines changed

app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function _prepareCollection()
9292
protected function _afterLoadCollection()
9393
{
9494
foreach ($this->getCollection() as $item) {
95-
$item->getCustomer() ?: $item->setCustomer('Guest');
95+
$item->getCustomer() ?: $item->setCustomer($item->getBillingAddress()->getName());
9696
}
9797
return $this;
9898
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Block\Dashboard\Orders;
8+
9+
use Magento\Backend\Block\Template\Context;
10+
11+
class GridTest extends \PHPUnit\Framework\TestCase
12+
{
13+
/**
14+
* @var Grid
15+
*/
16+
private $block;
17+
18+
protected function setUp()
19+
{
20+
parent::setUp();
21+
22+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
23+
$block = $this->createMock(\Magento\Backend\Block\Dashboard\Orders\Grid::class);
24+
$layout = $this->createMock(\Magento\Framework\View\LayoutInterface::class);
25+
$layout->expects($this->atLeastOnce())->method('getChildName')->willReturn('test');
26+
$layout->expects($this->atLeastOnce())->method('getBlock')->willReturn($block);
27+
$context = $objectManager->create(Context::class, ['layout' => $layout]);
28+
29+
$this->block = $objectManager->create(Grid::class, ['context' => $context]);
30+
}
31+
32+
/**
33+
* @magentoDataFixture Magento/Sales/_files/order.php
34+
*/
35+
public function testGetPreparedCollection()
36+
{
37+
$collection = $this->block->getPreparedCollection();
38+
foreach ($collection->getItems() as $item) {
39+
if ($item->getIncrementId() == '100000001') {
40+
$this->assertEquals('firstname lastname', $item->getCustomer());
41+
}
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)