3
3
* Copyright © 2015 Magento. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
- // @codingStandardsIgnoreFile
6
+ // @codingStandardsIgnoreFile
7
7
8
8
namespace Magento \Customer \Test \Unit \Controller \Adminhtml \Index ;
9
9
@@ -70,9 +70,7 @@ public function testExecute()
70
70
true ,
71
71
true
72
72
);
73
- $ this ->customer ->expects ($ this ->once ())
74
- ->method ('getWebsiteId ' )
75
- ->willReturn (2 );
73
+ $ this ->customer ->expects ($ this ->once ())->method ('getWebsiteId ' )->willReturn (2 );
76
74
77
75
$ this ->customerDataFactory = $ this ->getMock (
78
76
'Magento\Customer\Api\Data\CustomerInterfaceFactory ' ,
@@ -81,10 +79,7 @@ public function testExecute()
81
79
'' ,
82
80
false
83
81
);
84
- $ this ->customerDataFactory
85
- ->expects ($ this ->once ())
86
- ->method ('create ' )
87
- ->willReturn ($ this ->customer );
82
+ $ this ->customerDataFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ($ this ->customer );
88
83
89
84
$ this ->request = $ this ->getMockForAbstractClass (
90
85
'Magento\Framework\App\RequestInterface ' ,
@@ -101,34 +96,16 @@ public function testExecute()
101
96
'_template_ ' => null ,
102
97
'address_index ' => null
103
98
]);
104
- $ this ->response = $ this ->getMockForAbstractClass (
105
- 'Magento\Framework\App\ResponseInterface ' ,
106
- [],
107
- '' ,
108
- false
109
- );
110
- $ this ->form = $ this ->getMock (
111
- 'Magento\Customer\Model\Metadata\Form ' ,
112
- [],
113
- [],
114
- '' ,
115
- false
116
- );
117
- $ this ->form ->expects ($ this ->once ())
118
- ->method ('setInvisibleIgnored ' );
119
- $ this ->form ->expects ($ this ->atLeastOnce ())
120
- ->method ('extractData ' )
121
- ->willReturn ([]);
99
+ $ this ->response = $ this ->getMockForAbstractClass ('Magento\Framework\App\ResponseInterface ' , [], '' , false );
100
+ $ this ->form = $ this ->getMock ('Magento\Customer\Model\Metadata\Form ' , [], [], '' , false );
101
+ $ this ->form ->expects ($ this ->once ())->method ('setInvisibleIgnored ' );
102
+ $ this ->form ->expects ($ this ->atLeastOnce ())->method ('extractData ' )->willReturn ([]);
122
103
123
104
$ error = $ this ->getMock ('Magento\Framework\Message\Error ' , [], [], '' , false );
124
- $ this ->form ->expects ($ this ->once ())
125
- ->method ('validateData ' )
126
- ->willReturn ([$ error ]);
105
+ $ this ->form ->expects ($ this ->once ())->method ('validateData ' )->willReturn ([$ error ]);
127
106
128
107
$ this ->formFactory = $ this ->getMock ('Magento\Customer\Model\Metadata\FormFactory ' , ['create ' ], [], '' , false );
129
- $ this ->formFactory ->expects ($ this ->atLeastOnce ())
130
- ->method ('create ' )
131
- ->willReturn ($ this ->form );
108
+ $ this ->formFactory ->expects ($ this ->atLeastOnce ())->method ('create ' )->willReturn ($ this ->form );
132
109
133
110
$ this ->extensibleDataObjectConverter = $ this ->getMock (
134
111
'Magento\Framework\Api\ExtensibleDataObjectConverter ' ,
@@ -137,14 +114,10 @@ public function testExecute()
137
114
'' ,
138
115
false
139
116
);
140
- $ this ->extensibleDataObjectConverter ->expects ($ this ->once ())
141
- ->method ('toFlatArray ' )
142
- ->willReturn ([]);
117
+ $ this ->extensibleDataObjectConverter ->expects ($ this ->once ())->method ('toFlatArray ' )->willReturn ([]);
143
118
144
119
$ this ->dataObjectHelper = $ this ->getMock ('Magento\Framework\Api\DataObjectHelper ' , [], [], '' , false );
145
- $ this ->dataObjectHelper
146
- ->expects ($ this ->once ())
147
- ->method ('populateWithArray ' );
120
+ $ this ->dataObjectHelper ->expects ($ this ->once ())->method ('populateWithArray ' );
148
121
149
122
$ this ->customerAccountManagement = $ this ->getMockForAbstractClass (
150
123
'Magento\Customer\Api\AccountManagementInterface ' ,
@@ -163,29 +136,20 @@ public function testExecute()
163
136
true ,
164
137
true
165
138
);
166
- $ validationResult ->expects ($ this ->once ())
167
- ->method ('getMessages ' )
168
- ->willReturn (['Error message ' ]);
139
+ $ validationResult ->expects ($ this ->once ())->method ('getMessages ' )->willReturn (['Error message ' ]);
169
140
170
- $ this ->customerAccountManagement ->expects ($ this ->once ())
171
- ->method ('validate ' )
172
- ->willReturn ($ validationResult );
141
+ $ this ->customerAccountManagement ->expects ($ this ->once ())->method ('validate ' )->willReturn ($ validationResult );
173
142
174
143
$ this ->resultJson = $ this ->getMock ('Magento\Framework\Controller\Result\Json ' , [], [], '' , false );
175
- $ this ->resultJson ->expects ($ this ->once ())
176
- ->method ('setData ' );
144
+ $ this ->resultJson ->expects ($ this ->once ())->method ('setData ' );
177
145
$ this ->resultJsonFactory = $ this ->getMock (
178
146
'Magento\Framework\Controller\Result\JsonFactory ' ,
179
147
['create ' ],
180
148
[],
181
149
'' ,
182
150
false
183
151
);
184
- $ this ->resultJsonFactory
185
- ->expects ($ this ->once ())
186
- ->method ('create ' )
187
- ->willReturn ($ this ->resultJson );
188
-
152
+ $ this ->resultJsonFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ($ this ->resultJson );
189
153
$ this ->getController ()->execute ();
190
154
}
191
155
@@ -199,9 +163,7 @@ public function testExecuteWithoutAddresses()
199
163
true ,
200
164
true
201
165
);
202
- $ this ->customer ->expects ($ this ->once ())
203
- ->method ('getWebsiteId ' )
204
- ->willReturn (2 );
166
+ $ this ->customer ->expects ($ this ->once ())->method ('getWebsiteId ' )->willReturn (2 );
205
167
206
168
$ this ->customerDataFactory = $ this ->getMock (
207
169
'Magento\Customer\Api\Data\CustomerInterfaceFactory ' ,
@@ -210,10 +172,7 @@ public function testExecuteWithoutAddresses()
210
172
'' ,
211
173
false
212
174
);
213
- $ this ->customerDataFactory
214
- ->expects ($ this ->once ())
215
- ->method ('create ' )
216
- ->willReturn ($ this ->customer );
175
+ $ this ->customerDataFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ($ this ->customer );
217
176
218
177
$ this ->request = $ this ->getMockForAbstractClass (
219
178
'Magento\Framework\App\RequestInterface ' ,
@@ -224,37 +183,17 @@ public function testExecuteWithoutAddresses()
224
183
true ,
225
184
['getPost ' ]
226
185
);
227
- $ this ->request ->expects ($ this ->once ())
228
- ->method ('getPost ' )
229
- ->willReturn (null );
230
- $ this ->response = $ this ->getMockForAbstractClass (
231
- 'Magento\Framework\App\ResponseInterface ' ,
232
- [],
233
- '' ,
234
- false
235
- );
236
- $ this ->form = $ this ->getMock (
237
- 'Magento\Customer\Model\Metadata\Form ' ,
238
- [],
239
- [],
240
- '' ,
241
- false
242
- );
243
- $ this ->form ->expects ($ this ->once ())
244
- ->method ('setInvisibleIgnored ' );
245
- $ this ->form ->expects ($ this ->atLeastOnce ())
246
- ->method ('extractData ' )
247
- ->willReturn ([]);
186
+ $ this ->request ->expects ($ this ->once ())->method ('getPost ' )->willReturn (null );
187
+ $ this ->response = $ this ->getMockForAbstractClass ('Magento\Framework\App\ResponseInterface ' , [], '' , false );
188
+ $ this ->form = $ this ->getMock ('Magento\Customer\Model\Metadata\Form ' , [], [], '' , false );
189
+ $ this ->form ->expects ($ this ->once ())->method ('setInvisibleIgnored ' );
190
+ $ this ->form ->expects ($ this ->atLeastOnce ())->method ('extractData ' )->willReturn ([]);
248
191
249
192
$ error = $ this ->getMock ('Magento\Framework\Message\Error ' , [], [], '' , false );
250
- $ this ->form ->expects ($ this ->never ())
251
- ->method ('validateData ' )
252
- ->willReturn ([$ error ]);
193
+ $ this ->form ->expects ($ this ->never ())->method ('validateData ' )->willReturn ([$ error ]);
253
194
254
195
$ this ->formFactory = $ this ->getMock ('Magento\Customer\Model\Metadata\FormFactory ' , ['create ' ], [], '' , false );
255
- $ this ->formFactory ->expects ($ this ->atLeastOnce ())
256
- ->method ('create ' )
257
- ->willReturn ($ this ->form );
196
+ $ this ->formFactory ->expects ($ this ->atLeastOnce ())->method ('create ' )->willReturn ($ this ->form );
258
197
259
198
$ this ->extensibleDataObjectConverter = $ this ->getMock (
260
199
'Magento\Framework\Api\ExtensibleDataObjectConverter ' ,
@@ -263,14 +202,10 @@ public function testExecuteWithoutAddresses()
263
202
'' ,
264
203
false
265
204
);
266
- $ this ->extensibleDataObjectConverter ->expects ($ this ->once ())
267
- ->method ('toFlatArray ' )
268
- ->willReturn ([]);
205
+ $ this ->extensibleDataObjectConverter ->expects ($ this ->once ())->method ('toFlatArray ' )->willReturn ([]);
269
206
270
207
$ this ->dataObjectHelper = $ this ->getMock ('Magento\Framework\Api\DataObjectHelper ' , [], [], '' , false );
271
- $ this ->dataObjectHelper
272
- ->expects ($ this ->once ())
273
- ->method ('populateWithArray ' );
208
+ $ this ->dataObjectHelper ->expects ($ this ->once ())->method ('populateWithArray ' );
274
209
275
210
$ this ->customerAccountManagement = $ this ->getMockForAbstractClass (
276
211
'Magento\Customer\Api\AccountManagementInterface ' ,
@@ -289,29 +224,20 @@ public function testExecuteWithoutAddresses()
289
224
true ,
290
225
true
291
226
);
292
- $ validationResult ->expects ($ this ->once ())
293
- ->method ('getMessages ' )
294
- ->willReturn (['Error message ' ]);
227
+ $ validationResult ->expects ($ this ->once ())->method ('getMessages ' )->willReturn (['Error message ' ]);
295
228
296
- $ this ->customerAccountManagement ->expects ($ this ->once ())
297
- ->method ('validate ' )
298
- ->willReturn ($ validationResult );
229
+ $ this ->customerAccountManagement ->expects ($ this ->once ())->method ('validate ' )->willReturn ($ validationResult );
299
230
300
231
$ this ->resultJson = $ this ->getMock ('Magento\Framework\Controller\Result\Json ' , [], [], '' , false );
301
- $ this ->resultJson ->expects ($ this ->once ())
302
- ->method ('setData ' );
232
+ $ this ->resultJson ->expects ($ this ->once ())->method ('setData ' );
303
233
$ this ->resultJsonFactory = $ this ->getMock (
304
234
'Magento\Framework\Controller\Result\JsonFactory ' ,
305
235
['create ' ],
306
236
[],
307
237
'' ,
308
238
false
309
239
);
310
- $ this ->resultJsonFactory
311
- ->expects ($ this ->once ())
312
- ->method ('create ' )
313
- ->willReturn ($ this ->resultJson );
314
-
240
+ $ this ->resultJsonFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ($ this ->resultJson );
315
241
$ this ->getController ()->execute ();
316
242
}
317
243
@@ -325,9 +251,7 @@ public function testExecuteWithException()
325
251
true ,
326
252
true
327
253
);
328
- $ this ->customer ->expects ($ this ->once ())
329
- ->method ('getWebsiteId ' )
330
- ->willReturn (2 );
254
+ $ this ->customer ->expects ($ this ->once ())->method ('getWebsiteId ' )->willReturn (2 );
331
255
332
256
$ this ->customerDataFactory = $ this ->getMock (
333
257
'Magento\Customer\Api\Data\CustomerInterfaceFactory ' ,
@@ -336,11 +260,7 @@ public function testExecuteWithException()
336
260
'' ,
337
261
false
338
262
);
339
- $ this ->customerDataFactory
340
- ->expects ($ this ->once ())
341
- ->method ('create ' )
342
- ->willReturn ($ this ->customer );
343
-
263
+ $ this ->customerDataFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ($ this ->customer );
344
264
$ this ->request = $ this ->getMockForAbstractClass (
345
265
'Magento\Framework\App\RequestInterface ' ,
346
266
[],
@@ -350,35 +270,16 @@ public function testExecuteWithException()
350
270
true ,
351
271
['getPost ' ]
352
272
);
353
- $ this ->request ->expects ($ this ->once ())
354
- ->method ('getPost ' )
355
- ->willReturn (null );
356
- $ this ->response = $ this ->getMockForAbstractClass (
357
- 'Magento\Framework\App\ResponseInterface ' ,
358
- [],
359
- '' ,
360
- false
361
- );
362
- $ this ->form = $ this ->getMock (
363
- 'Magento\Customer\Model\Metadata\Form ' ,
364
- [],
365
- [],
366
- '' ,
367
- false
368
- );
369
- $ this ->form ->expects ($ this ->once ())
370
- ->method ('setInvisibleIgnored ' );
371
- $ this ->form ->expects ($ this ->atLeastOnce ())
372
- ->method ('extractData ' )
373
- ->willReturn ([]);
273
+ $ this ->request ->expects ($ this ->once ())->method ('getPost ' )->willReturn (null );
274
+ $ this ->response = $ this ->getMockForAbstractClass ('Magento\Framework\App\ResponseInterface ' , [], '' ,false );
275
+ $ this ->form = $ this ->getMock ('Magento\Customer\Model\Metadata\Form ' , [], [], '' , false );
276
+ $ this ->form ->expects ($ this ->once ())->method ('setInvisibleIgnored ' );
277
+ $ this ->form ->expects ($ this ->atLeastOnce ())->method ('extractData ' )->willReturn ([]);
374
278
375
- $ this ->form ->expects ($ this ->never ())
376
- ->method ('validateData ' );
279
+ $ this ->form ->expects ($ this ->never ())->method ('validateData ' );
377
280
378
281
$ this ->formFactory = $ this ->getMock ('Magento\Customer\Model\Metadata\FormFactory ' , ['create ' ], [], '' , false );
379
- $ this ->formFactory ->expects ($ this ->atLeastOnce ())
380
- ->method ('create ' )
381
- ->willReturn ($ this ->form );
282
+ $ this ->formFactory ->expects ($ this ->atLeastOnce ())->method ('create ' )->willReturn ($ this ->form );
382
283
383
284
$ this ->extensibleDataObjectConverter = $ this ->getMock (
384
285
'Magento\Framework\Api\ExtensibleDataObjectConverter ' ,
@@ -387,14 +288,10 @@ public function testExecuteWithException()
387
288
'' ,
388
289
false
389
290
);
390
- $ this ->extensibleDataObjectConverter ->expects ($ this ->once ())
391
- ->method ('toFlatArray ' )
392
- ->willReturn ([]);
291
+ $ this ->extensibleDataObjectConverter ->expects ($ this ->once ())->method ('toFlatArray ' )->willReturn ([]);
393
292
394
293
$ this ->dataObjectHelper = $ this ->getMock ('Magento\Framework\Api\DataObjectHelper ' , [], [], '' , false );
395
- $ this ->dataObjectHelper
396
- ->expects ($ this ->once ())
397
- ->method ('populateWithArray ' );
294
+ $ this ->dataObjectHelper ->expects ($ this ->once ())->method ('populateWithArray ' );
398
295
399
296
$ this ->customerAccountManagement = $ this ->getMockForAbstractClass (
400
297
'Magento\Customer\Api\AccountManagementInterface ' ,
@@ -414,37 +311,24 @@ public function testExecuteWithException()
414
311
true
415
312
);
416
313
$ error = $ this ->getMock ('Magento\Framework\Message\Error ' , [], [], '' , false );
417
- $ error ->expects ($ this ->once ())
418
- ->method ('getText ' )
419
- ->willReturn ('Error text ' );
314
+ $ error ->expects ($ this ->once ())->method ('getText ' )->willReturn ('Error text ' );
420
315
421
316
$ exception = $ this ->getMock ('Magento\Framework\Validator\Exception ' , [], [], '' , false );
422
- $ exception ->expects ($ this ->once ())
423
- ->method ('getMessages ' )
424
- ->willReturn ([$ error ]);
425
- $ validationResult ->expects ($ this ->once ())
426
- ->method ('getMessages ' )
427
- ->willThrowException ($ exception );
317
+ $ exception ->expects ($ this ->once ())->method ('getMessages ' )->willReturn ([$ error ]);
318
+ $ validationResult ->expects ($ this ->once ())->method ('getMessages ' )->willThrowException ($ exception );
428
319
429
- $ this ->customerAccountManagement ->expects ($ this ->once ())
430
- ->method ('validate ' )
431
- ->willReturn ($ validationResult );
320
+ $ this ->customerAccountManagement ->expects ($ this ->once ())->method ('validate ' )->willReturn ($ validationResult );
432
321
433
322
$ this ->resultJson = $ this ->getMock ('Magento\Framework\Controller\Result\Json ' , [], [], '' , false );
434
- $ this ->resultJson ->expects ($ this ->once ())
435
- ->method ('setData ' );
323
+ $ this ->resultJson ->expects ($ this ->once ())->method ('setData ' );
436
324
$ this ->resultJsonFactory = $ this ->getMock (
437
325
'Magento\Framework\Controller\Result\JsonFactory ' ,
438
326
['create ' ],
439
327
[],
440
328
'' ,
441
329
false
442
330
);
443
- $ this ->resultJsonFactory
444
- ->expects ($ this ->once ())
445
- ->method ('create ' )
446
- ->willReturn ($ this ->resultJson );
447
-
331
+ $ this ->resultJsonFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ($ this ->resultJson );
448
332
$ this ->getController ()->execute ();
449
333
}
450
334
0 commit comments