Skip to content

Commit

Permalink
⏫ Forwardport of #12241 to 2.3-develop branch
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
magento-engcom-team committed Jan 24, 2018
1 parent 8e77e2f commit 742819b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function _prepareCollection()
protected function _afterLoadCollection()
{
foreach ($this->getCollection() as $item) {
$item->getCustomer() ?: $item->setCustomer('Guest');
$item->getCustomer() ?: $item->setCustomer($item->getBillingAddress()->getName());
}
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Backend\Block\Dashboard\Orders;

use Magento\Backend\Block\Template\Context;

class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Grid
*/
private $block;

protected function setUp()
{
parent::setUp();

$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$block = $this->createMock(\Magento\Backend\Block\Dashboard\Orders\Grid::class);
$layout = $this->createMock(\Magento\Framework\View\LayoutInterface::class);
$layout->expects($this->atLeastOnce())->method('getChildName')->willReturn('test');
$layout->expects($this->atLeastOnce())->method('getBlock')->willReturn($block);
$context = $objectManager->create(Context::class, ['layout' => $layout]);

$this->block = $objectManager->create(Grid::class, ['context' => $context]);
}

/**
* @magentoDataFixture Magento/Sales/_files/order.php
*/
public function testGetPreparedCollection()
{
$collection = $this->block->getPreparedCollection();
foreach ($collection->getItems() as $item) {
if ($item->getIncrementId() == '100000001') {
$this->assertEquals('firstname lastname', $item->getCustomer());
}
}
}
}

0 comments on commit 742819b

Please sign in to comment.