From ef165a2d3666d92a109252541c399e55695c830b Mon Sep 17 00:00:00 2001 From: RomanKis Date: Tue, 14 Nov 2017 14:42:29 +0200 Subject: [PATCH 1/3] 10128: New Orders not being saved to order grid --- .../Backend/Block/Dashboard/Orders/Grid.php | 2 +- .../Block/Dashboard/Orders/GridTest.php | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php diff --git a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php index 9d9409fba093b..50279786c0a5b 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php +++ b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php @@ -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; } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php new file mode 100644 index 0000000000000..859837d4af130 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php @@ -0,0 +1,40 @@ +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(); + $this->assertEquals('firstname lastname', $collection->getItems()[1]->getCustomer()); + } +} From 1ebcd7add6e6bcb2f8deb62ba5754e3110b59f12 Mon Sep 17 00:00:00 2001 From: RomanKis Date: Tue, 14 Nov 2017 15:19:44 +0200 Subject: [PATCH 2/3] 10128: New Orders not being saved to order grid --- .../Magento/Backend/Block/Dashboard/Orders/GridTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php index 859837d4af130..9572bf10618fc 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php @@ -8,6 +8,10 @@ use Magento\Backend\Block\Template\Context; +/** + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + */ class GridTest extends \PHPUnit\Framework\TestCase { /** From a933cf745b4e6cc82d07cefb00cd4af9874e034f Mon Sep 17 00:00:00 2001 From: RomanKis Date: Tue, 14 Nov 2017 15:46:34 +0200 Subject: [PATCH 3/3] 10128: New Orders not being saved to order grid --- .../Backend/Block/Dashboard/Orders/GridTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php index 9572bf10618fc..6c91afb80fd4a 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Orders/GridTest.php @@ -8,10 +8,6 @@ use Magento\Backend\Block\Template\Context; -/** - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled - */ class GridTest extends \PHPUnit\Framework\TestCase { /** @@ -39,6 +35,10 @@ protected function setUp() public function testGetPreparedCollection() { $collection = $this->block->getPreparedCollection(); - $this->assertEquals('firstname lastname', $collection->getItems()[1]->getCustomer()); + foreach ($collection->getItems() as $item) { + if ($item->getIncrementId() == '100000001') { + $this->assertEquals('firstname lastname', $item->getCustomer()); + } + } } }