File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
Model/ResourceModel/Quote
Test/Unit/Model/ResourceModel/Quote Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ public function resolveCustomerNames()
156
156
157
157
$ select ->from (
158
158
['customer ' => $ this ->customerResource ->getTable ('customer_entity ' )],
159
- ['email ' ]
159
+ ['entity_id ' , ' email ' ]
160
160
);
161
161
$ select ->columns (
162
162
['customer_name ' => $ customerName ]
@@ -171,8 +171,11 @@ public function resolveCustomerNames()
171
171
$ customersData = $ this ->customerResource ->getConnection ()->fetchAll ($ select );
172
172
173
173
foreach ($ this ->getItems () as $ item ) {
174
- $ item ->setData (array_merge ($ item ->getData (), current ($ customersData )));
175
- next ($ customersData );
174
+ foreach ($ customersData as $ customerItemData ) {
175
+ if ($ item ['customer_id ' ] == $ customerItemData ['entity_id ' ]) {
176
+ $ item ->setData (array_merge ($ item ->getData (), $ customerItemData ));
177
+ }
178
+ }
176
179
}
177
180
}
178
181
}
Original file line number Diff line number Diff line change @@ -110,15 +110,14 @@ public function testResolveCustomerNames()
110
110
$ customerName = "CONCAT_WS('firstname', 'lastname') " ;
111
111
$ customerTableName = 'customer_entity ' ;
112
112
$ customerId = ['customer_id ' => ['test_id ' ]];
113
- $ customersData = [['item_1 ' ]];
114
- $ itemData = ['test ' ];
113
+ $ customersData = [['entity_id ' => 'test_id ' , 'name ' => 'item_1 ' ]];
115
114
116
115
$ this ->selectMock ->expects ($ this ->any ())
117
116
->method ('getConnection ' )
118
117
->willReturn ($ this ->connectionMock );
119
118
$ this ->selectMock ->expects ($ this ->once ())
120
119
->method ('from ' )
121
- ->with (['customer ' => $ customerTableName ], ['email ' ])
120
+ ->with (['customer ' => $ customerTableName ], ['entity_id ' , ' email ' ])
122
121
->willReturnSelf ();
123
122
$ this ->selectMock ->expects ($ this ->once ())
124
123
->method ('columns ' )
@@ -158,9 +157,6 @@ public function testResolveCustomerNames()
158
157
$ itemMock = $ this ->getMockBuilder ('Magento\Framework\Model\AbstractModel ' )
159
158
->disableOriginalConstructor ()
160
159
->getMock ();
161
- $ itemMock ->expects ($ this ->once ())
162
- ->method ('getData ' )
163
- ->willReturn ($ itemData );
164
160
165
161
$ this ->entityFactoryMock ->expects ($ this ->any ())
166
162
->method ('create ' )
You can’t perform that action at this time.
0 commit comments