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 Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ protected function _prepareCollection()
92
92
protected function _afterLoadCollection ()
93
93
{
94
94
foreach ($ this ->getCollection () as $ item ) {
95
- $ item ->getCustomer () ?: $ item ->setCustomer (' Guest ' );
95
+ $ item ->getCustomer () ?: $ item ->setCustomer ($ item -> getBillingAddress ()-> getName () );
96
96
}
97
97
return $ this ;
98
98
}
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments