@@ -107,7 +107,7 @@ protected function setUp()
107
107
$ this ->createMock (\Magento \Customer \Model \ResourceModel \Customer::class);
108
108
$ this ->customerRegistry = $ this ->createMock (\Magento \Customer \Model \CustomerRegistry::class);
109
109
$ this ->dataObjectHelper = $ this ->createMock (\Magento \Framework \Api \DataObjectHelper::class);
110
- $ this ->customerFactory =
110
+ $ this ->customerFactory =
111
111
$ this ->createPartialMock (\Magento \Customer \Model \CustomerFactory::class, ['create ' ]);
112
112
$ this ->customerSecureFactory = $ this ->createPartialMock (
113
113
\Magento \Customer \Model \Data \CustomerSecureFactory::class,
@@ -193,9 +193,10 @@ protected function setUp()
193
193
public function testSave ()
194
194
{
195
195
$ customerId = 1 ;
196
- $ storeId = 2 ;
197
196
198
- $ customerModel = $ this ->createPartialMock (\Magento \Customer \Model \Customer::class, [
197
+ $ customerModel = $ this ->createPartialMock (
198
+ \Magento \Customer \Model \Customer::class,
199
+ [
199
200
'getId ' ,
200
201
'setId ' ,
201
202
'setStoreId ' ,
@@ -210,7 +211,8 @@ public function testSave()
210
211
'setFirstFailure ' ,
211
212
'setLockExpires ' ,
212
213
'save ' ,
213
- ]);
214
+ ]
215
+ );
214
216
215
217
$ origCustomer = $ this ->customer ;
216
218
@@ -229,14 +231,17 @@ public function testSave()
229
231
'setAddresses '
230
232
]
231
233
);
232
- $ customerSecureData = $ this ->createPartialMock (\Magento \Customer \Model \Data \CustomerSecure::class, [
233
- 'getRpToken ' ,
234
- 'getRpTokenCreatedAt ' ,
235
- 'getPasswordHash ' ,
236
- 'getFailuresNum ' ,
237
- 'getFirstFailure ' ,
238
- 'getLockExpires ' ,
239
- ]);
234
+ $ customerSecureData = $ this ->createPartialMock (
235
+ \Magento \Customer \Model \Data \CustomerSecure::class,
236
+ [
237
+ 'getRpToken ' ,
238
+ 'getRpTokenCreatedAt ' ,
239
+ 'getPasswordHash ' ,
240
+ 'getFailuresNum ' ,
241
+ 'getFirstFailure ' ,
242
+ 'getLockExpires ' ,
243
+ ]
244
+ );
240
245
$ this ->customer ->expects ($ this ->atLeastOnce ())
241
246
->method ('getId ' )
242
247
->willReturn ($ customerId );
@@ -268,17 +273,6 @@ public function testSave()
268
273
$ customerModel ->expects ($ this ->once ())
269
274
->method ('getStoreId ' )
270
275
->willReturn (null );
271
- $ store = $ this ->createMock (\Magento \Store \Model \Store::class);
272
- $ store ->expects ($ this ->once ())
273
- ->method ('getId ' )
274
- ->willReturn ($ storeId );
275
- $ this ->storeManager
276
- ->expects ($ this ->once ())
277
- ->method ('getStore ' )
278
- ->willReturn ($ store );
279
- $ customerModel ->expects ($ this ->once ())
280
- ->method ('setStoreId ' )
281
- ->with ($ storeId );
282
276
$ customerModel ->expects ($ this ->once ())
283
277
->method ('setId ' )
284
278
->with ($ customerId );
@@ -310,16 +304,20 @@ public function testSave()
310
304
311
305
$ customerModel ->expects ($ this ->once ())
312
306
->method ('setRpToken ' )
313
- ->willReturnMap ([
307
+ ->willReturnMap (
308
+ [
314
309
['rpToken ' , $ customerModel ],
315
310
[null , $ customerModel ],
316
- ]);
311
+ ]
312
+ );
317
313
$ customerModel ->expects ($ this ->once ())
318
314
->method ('setRpTokenCreatedAt ' )
319
- ->willReturnMap ([
315
+ ->willReturnMap (
316
+ [
320
317
['rpTokenCreatedAt ' , $ customerModel ],
321
318
[null , $ customerModel ],
322
- ]);
319
+ ]
320
+ );
323
321
324
322
$ customerModel ->expects ($ this ->once ())
325
323
->method ('setPasswordHash ' )
@@ -371,32 +369,37 @@ public function testSave()
371
369
public function testSaveWithPasswordHash ()
372
370
{
373
371
$ customerId = 1 ;
374
- $ storeId = 2 ;
375
372
$ passwordHash = 'ukfa4sdfa56s5df02asdf4rt ' ;
376
373
377
- $ customerSecureData = $ this ->createPartialMock (\Magento \Customer \Model \Data \CustomerSecure::class, [
378
- 'getRpToken ' ,
379
- 'getRpTokenCreatedAt ' ,
380
- 'getPasswordHash ' ,
381
- 'getFailuresNum ' ,
382
- 'getFirstFailure ' ,
383
- 'getLockExpires ' ,
384
- ]);
374
+ $ customerSecureData = $ this ->createPartialMock (
375
+ \Magento \Customer \Model \Data \CustomerSecure::class,
376
+ [
377
+ 'getRpToken ' ,
378
+ 'getRpTokenCreatedAt ' ,
379
+ 'getPasswordHash ' ,
380
+ 'getFailuresNum ' ,
381
+ 'getFirstFailure ' ,
382
+ 'getLockExpires ' ,
383
+ ]
384
+ );
385
385
$ origCustomer = $ this ->customer ;
386
386
387
- $ customerModel = $ this ->createPartialMock (\Magento \Customer \Model \Customer::class, [
388
- 'getId ' ,
389
- 'setId ' ,
390
- 'setStoreId ' ,
391
- 'getStoreId ' ,
392
- 'getAttributeSetId ' ,
393
- 'setAttributeSetId ' ,
394
- 'setRpToken ' ,
395
- 'setRpTokenCreatedAt ' ,
396
- 'getDataModel ' ,
397
- 'setPasswordHash ' ,
398
- 'save ' ,
399
- ]);
387
+ $ customerModel = $ this ->createPartialMock (
388
+ \Magento \Customer \Model \Customer::class,
389
+ [
390
+ 'getId ' ,
391
+ 'setId ' ,
392
+ 'setStoreId ' ,
393
+ 'getStoreId ' ,
394
+ 'getAttributeSetId ' ,
395
+ 'setAttributeSetId ' ,
396
+ 'setRpToken ' ,
397
+ 'setRpTokenCreatedAt ' ,
398
+ 'getDataModel ' ,
399
+ 'setPasswordHash ' ,
400
+ 'save ' ,
401
+ ]
402
+ );
400
403
$ customerAttributesMetaData = $ this ->getMockForAbstractClass (
401
404
\Magento \Framework \Api \CustomAttributesDataInterface::class,
402
405
[],
@@ -447,7 +450,6 @@ public function testSaveWithPasswordHash()
447
450
$ customerSecureData ->expects ($ this ->once ())
448
451
->method ('getLockExpires ' )
449
452
->willReturn ('lockExpires ' );
450
-
451
453
$ this ->customer ->expects ($ this ->atLeastOnce ())
452
454
->method ('getId ' )
453
455
->willReturn ($ customerId );
@@ -477,20 +479,6 @@ public function testSaveWithPasswordHash()
477
479
->method ('create ' )
478
480
->with (['data ' => ['customerData ' ]])
479
481
->willReturn ($ customerModel );
480
- $ customerModel ->expects ($ this ->once ())
481
- ->method ('getStoreId ' )
482
- ->willReturn (null );
483
- $ store = $ this ->createMock (\Magento \Store \Model \Store::class);
484
- $ store ->expects ($ this ->once ())
485
- ->method ('getId ' )
486
- ->willReturn ($ storeId );
487
- $ this ->storeManager
488
- ->expects ($ this ->once ())
489
- ->method ('getStore ' )
490
- ->willReturn ($ store );
491
- $ customerModel ->expects ($ this ->once ())
492
- ->method ('setStoreId ' )
493
- ->with ($ storeId );
494
482
$ customerModel ->expects ($ this ->once ())
495
483
->method ('setId ' )
496
484
->with ($ customerId );
0 commit comments