@@ -100,14 +100,14 @@ protected function setUp()
100
100
$ loggerMock = $ this ->getMock (\Psr \Log \LoggerInterface::class);
101
101
$ copyMock = $ this ->getMock (\Magento \Framework \DataObject \Copy::class, [], [], '' , false );
102
102
$ messageManagerMock = $ this ->getMock (\Magento \Framework \Message \ManagerInterface::class);
103
- $ this ->formFactoryMock = $ this ->getMock (
103
+ $ this ->formFactoryMock = $ this ->getMock (
104
104
\Magento \Customer \Model \Metadata \FormFactory::class,
105
105
['create ' ],
106
106
[],
107
107
'' ,
108
108
false
109
109
);
110
- $ this ->customerFactoryMock = $ this ->getMock (
110
+ $ this ->customerFactoryMock = $ this ->getMock (
111
111
\Magento \Customer \Api \Data \CustomerInterfaceFactory::class,
112
112
['create ' ],
113
113
[],
@@ -122,56 +122,56 @@ protected function setUp()
122
122
->setMethods (['create ' ])
123
123
->getMock ();
124
124
125
- $ this ->customerMapper = $ this ->getMockBuilder (
125
+ $ this ->customerMapper = $ this ->getMockBuilder (
126
126
\Magento \Customer \Model \Customer \Mapper::class
127
127
)->setMethods (['toFlatArray ' ])->disableOriginalConstructor ()->getMock ();
128
128
129
- $ this ->quoteInitializerMock = $ this ->getMock (
129
+ $ this ->quoteInitializerMock = $ this ->getMock (
130
130
\Magento \Sales \Model \AdminOrder \Product \Quote \Initializer::class,
131
131
[],
132
132
[],
133
133
'' ,
134
134
false
135
135
);
136
- $ this ->customerRepositoryMock = $ this ->getMockForAbstractClass (
136
+ $ this ->customerRepositoryMock = $ this ->getMockForAbstractClass (
137
137
\Magento \Customer \Api \CustomerRepositoryInterface::class,
138
138
[],
139
139
'' ,
140
140
false
141
141
);
142
- $ this ->addressRepositoryMock = $ this ->getMockForAbstractClass (
142
+ $ this ->addressRepositoryMock = $ this ->getMockForAbstractClass (
143
143
\Magento \Customer \Api \AddressRepositoryInterface::class,
144
144
[],
145
145
'' ,
146
146
false
147
147
);
148
- $ this ->addressFactoryMock = $ this ->getMock (
148
+ $ this ->addressFactoryMock = $ this ->getMock (
149
149
\Magento \Customer \Api \Data \AddressInterfaceFactory::class,
150
150
[],
151
151
[],
152
152
'' ,
153
153
false
154
154
);
155
- $ this ->groupRepositoryMock = $ this ->getMockForAbstractClass (
155
+ $ this ->groupRepositoryMock = $ this ->getMockForAbstractClass (
156
156
\Magento \Customer \Api \GroupRepositoryInterface::class,
157
157
[],
158
158
'' ,
159
159
false
160
160
);
161
- $ this ->scopeConfigMock = $ this ->getMockForAbstractClass (
161
+ $ this ->scopeConfigMock = $ this ->getMockForAbstractClass (
162
162
\Magento \Framework \App \Config \ScopeConfigInterface::class,
163
163
[],
164
164
'' ,
165
165
false
166
166
);
167
- $ this ->emailSenderMock = $ this ->getMock (
167
+ $ this ->emailSenderMock = $ this ->getMock (
168
168
\Magento \Sales \Model \AdminOrder \EmailSender::class,
169
169
[],
170
170
[],
171
171
'' ,
172
172
false
173
173
);
174
- $ this ->accountManagementMock = $ this ->getMockForAbstractClass (
174
+ $ this ->accountManagementMock = $ this ->getMockForAbstractClass (
175
175
\Magento \Customer \Api \AccountManagementInterface::class,
176
176
[],
177
177
'' ,
@@ -182,7 +182,7 @@ protected function setUp()
182
182
->getMock ();
183
183
184
184
$ objectManagerHelper = new ObjectManagerHelper ($ this );
185
- $ this ->adminOrderCreate = $ objectManagerHelper ->getObject (
185
+ $ this ->adminOrderCreate = $ objectManagerHelper ->getObject (
186
186
\Magento \Sales \Model \AdminOrder \Create::class,
187
187
[
188
188
'objectManager ' => $ objectManagerMock ,
@@ -219,7 +219,7 @@ public function testSetAccountData()
219
219
$ attributeMocks = [];
220
220
221
221
foreach ($ attributes as $ attribute ) {
222
- $ attributeMock = $ this ->getMock (
222
+ $ attributeMock = $ this ->getMock (
223
223
\Magento \Customer \Api \Data \AttributeMetadataInterface::class,
224
224
[],
225
225
[],
@@ -232,7 +232,7 @@ public function testSetAccountData()
232
232
$ attributeMocks [] = $ attributeMock ;
233
233
}
234
234
235
- $ customerGroupMock = $ this ->getMockForAbstractClass (
235
+ $ customerGroupMock = $ this ->getMockForAbstractClass (
236
236
\Magento \Customer \Api \Data \GroupInterface::class,
237
237
[],
238
238
'' ,
@@ -243,9 +243,9 @@ public function testSetAccountData()
243
243
);
244
244
$ customerGroupMock ->expects ($ this ->once ())->method ('getTaxClassId ' )->will ($ this ->returnValue ($ taxClassId ));
245
245
$ customerFormMock = $ this ->getMock (\Magento \Customer \Model \Metadata \Form::class, [], [], '' , false );
246
- $ customerFormMock ->expects ($ this ->any ())->method ('getAttributes ' )->will ($ this ->returnValue ($ attributeMocks ));
246
+ $ customerFormMock ->expects ($ this ->any ())->method ('getAttributes ' )->will ($ this ->returnValue ([ $ attributeMocks[ 1 ]] ));
247
247
$ customerFormMock ->expects ($ this ->any ())->method ('extractData ' )->will ($ this ->returnValue ([]));
248
- $ customerFormMock ->expects ($ this ->any ())->method ('restoreData ' )->will ($ this ->returnValue ([]));
248
+ $ customerFormMock ->expects ($ this ->any ())->method ('restoreData ' )->will ($ this ->returnValue ([' group_id ' => 1 ]));
249
249
250
250
$ customerFormMock ->expects ($ this ->any ())
251
251
->method ('prepareRequest ' )
@@ -254,7 +254,7 @@ public function testSetAccountData()
254
254
$ customerMock = $ this ->getMock (\Magento \Customer \Api \Data \CustomerInterface::class, [], [], '' , false );
255
255
$ this ->customerMapper ->expects ($ this ->atLeastOnce ())
256
256
->method ('toFlatArray ' )
257
- ->
willReturn ([
'email ' => ' [email protected] ' , ' group_id ' => 1 , ' gender ' =>
1 ]);
257
+ ->willReturn (['group_id ' => 1 ]);
258
258
259
259
260
260
$ quoteMock = $ this ->getMock (\Magento \Quote \Model \Quote::class, [], [], '' , false );
@@ -263,7 +263,6 @@ public function testSetAccountData()
263
263
->method ('addData ' )
264
264
->with (
265
265
[
266
- 'customer_email ' => $ attributes [0 ][1 ],
267
266
'customer_group_id ' => $ attributes [1 ][1 ],
268
267
'customer_tax_class_id ' => $ taxClassId
269
268
]
@@ -272,7 +271,7 @@ public function testSetAccountData()
272
271
->method ('populateWithArray ' )
273
272
->with (
274
273
$ customerMock ,
275
- [
'email ' => ' [email protected] ' , ' group_id ' => 1 , ' gender ' =>
1 ], \
Magento \
Customer \
Api \
Data \CustomerInterface::class
274
+ ['group_id ' => 1 ], \Magento \Customer \Api \Data \CustomerInterface::class
276
275
);
277
276
278
277
$ this ->formFactoryMock ->expects ($ this ->any ())->method ('create ' )->will ($ this ->returnValue ($ customerFormMock ));
@@ -283,7 +282,7 @@ public function testSetAccountData()
283
282
->method ('getById ' )
284
283
->will ($ this ->returnValue ($ customerGroupMock ));
285
284
286
- $ this ->adminOrderCreate ->setAccountData ([]);
285
+ $ this ->adminOrderCreate ->setAccountData ([' group_id ' => 1 ]);
287
286
}
288
287
289
288
public function testUpdateQuoteItemsNotArray ()
0 commit comments