@@ -241,13 +241,16 @@ protected function setUp()
241
241
'visitorCollectionFactory ' => $ this ->visitorCollectionFactory ,
242
242
]
243
243
);
244
- $ reflection = new \ReflectionClass (get_class ($ this ->accountManagement ));
245
- $ reflectionProperty = $ reflection ->getProperty ('authentication ' );
246
- $ reflectionProperty ->setAccessible (true );
247
- $ reflectionProperty ->setValue ($ this ->accountManagement , $ this ->authenticationMock );
248
- $ reflectionProperty = $ reflection ->getProperty ('emailNotification ' );
249
- $ reflectionProperty ->setAccessible (true );
250
- $ reflectionProperty ->setValue ($ this ->accountManagement , $ this ->emailNotificationMock );
244
+ $ this ->objectManagerHelper ->setBackwardCompatibleProperty (
245
+ $ this ->accountManagement ,
246
+ 'authentication ' ,
247
+ $ this ->authenticationMock
248
+ );
249
+ $ this ->objectManagerHelper ->setBackwardCompatibleProperty (
250
+ $ this ->accountManagement ,
251
+ 'emailNotification ' ,
252
+ $ this ->emailNotificationMock
253
+ );
251
254
}
252
255
253
256
/**
@@ -703,14 +706,14 @@ public function dataProviderCheckPasswordStrength()
703
706
'testNumber ' => 1 ,
704
707
'password ' => 'qwer ' ,
705
708
'minPasswordLength ' => 5 ,
706
- 'minCharacterSetsNum ' => 1
709
+ 'minCharacterSetsNum ' => 1 ,
707
710
],
708
711
[
709
712
'testNumber ' => 2 ,
710
713
'password ' => 'wrfewqedf1 ' ,
711
714
'minPasswordLength ' => 5 ,
712
- 'minCharacterSetsNum ' => 3
713
- ]
715
+ 'minCharacterSetsNum ' => 3 ,
716
+ ],
714
717
];
715
718
}
716
719
@@ -742,7 +745,8 @@ public function testCreateAccountWithPasswordInputException(
742
745
AccountManagement::XML_PATH_REQUIRED_CHARACTER_CLASSES_NUMBER ,
743
746
'default ' ,
744
747
null ,
745
- $ minCharacterSetsNum ],
748
+ $ minCharacterSetsNum ,
749
+ ],
746
750
]
747
751
)
748
752
);
@@ -826,7 +830,8 @@ public function testCreateAccountWithPassword()
826
830
AccountManagement::XML_PATH_REQUIRED_CHARACTER_CLASSES_NUMBER ,
827
831
'default ' ,
828
832
null ,
829
- $ minCharacterSetsNum ],
833
+ $ minCharacterSetsNum ,
834
+ ],
830
835
[
831
836
AccountManagement::XML_PATH_REGISTER_EMAIL_TEMPLATE ,
832
837
ScopeInterface::SCOPE_STORE ,
@@ -837,8 +842,8 @@ public function testCreateAccountWithPassword()
837
842
AccountManagement::XML_PATH_REGISTER_EMAIL_IDENTITY ,
838
843
ScopeInterface::SCOPE_STORE ,
839
844
1 ,
840
- $ sender
841
- ]
845
+ $ sender,
846
+ ],
842
847
]
843
848
);
844
849
$ this ->string ->expects ($ this ->any ())
@@ -1318,13 +1323,11 @@ private function reInitModel()
1318
1323
]
1319
1324
)
1320
1325
->getMock ();
1321
- $ this ->customerSecure
1322
- ->expects ($ this ->any ())
1326
+ $ this ->customerSecure ->expects ($ this ->any ())
1323
1327
->method ('getRpToken ' )
1324
1328
->willReturn ('newStringToken ' );
1325
1329
$ pastDateTime = '2016-10-25 00:00:00 ' ;
1326
- $ this ->customerSecure
1327
- ->expects ($ this ->any ())
1330
+ $ this ->customerSecure ->expects ($ this ->any ())
1328
1331
->method ('getRpTokenCreatedAt ' )
1329
1332
->willReturn ($ pastDateTime );
1330
1333
$ this ->customer = $ this ->getMockBuilder (\Magento \Customer \Model \Customer::class)
@@ -1359,12 +1362,10 @@ private function reInitModel()
1359
1362
->method ('format ' )
1360
1363
->with (\Magento \Framework \Stdlib \DateTime::DATETIME_PHP_FORMAT )
1361
1364
->willReturn ($ dateTime );
1362
- $ dateTimeMock
1363
- ->expects ($ this ->any ())
1365
+ $ dateTimeMock ->expects ($ this ->any ())
1364
1366
->method ('getTimestamp ' )
1365
1367
->willReturn ($ timestamp );
1366
- $ dateTimeMock
1367
- ->expects ($ this ->any ())
1368
+ $ dateTimeMock ->expects ($ this ->any ())
1368
1369
->method ('setTimestamp ' )
1369
1370
->willReturnSelf ();
1370
1371
$ dateTimeFactory = $ this ->getMockBuilder (DateTimeFactory::class)
@@ -1456,7 +1457,7 @@ public function testChangePassword()
1456
1457
AccountManagement::XML_PATH_REQUIRED_CHARACTER_CLASSES_NUMBER ,
1457
1458
'default ' ,
1458
1459
null ,
1459
- 1
1460
+ 1 ,
1460
1461
],
1461
1462
]
1462
1463
);
@@ -1478,8 +1479,8 @@ public function testChangePassword()
1478
1479
->disableOriginalConstructor ()
1479
1480
->setMethods (['getSessionId ' ])
1480
1481
->getMock ();
1481
- $ visitor ->expects ($ this ->at ( 0 ))->method ('getSessionId ' )-> willReturn ( ' session_id_1 ' );
1482
- $ visitor -> expects ( $ this -> at ( 1 ))-> method ( ' getSessionId ' )-> willReturn ( 'session_id_2 ' );
1482
+ $ visitor ->expects ($ this ->atLeastOnce ( ))->method ('getSessionId ' )
1483
+ -> willReturnOnConsecutiveCalls ( ' session_id_1 ' , 'session_id_2 ' );
1483
1484
$ visitorCollection = $ this ->getMockBuilder (
1484
1485
\Magento \Customer \Model \ResourceModel \Visitor \CollectionFactory::class
1485
1486
)
@@ -1488,8 +1489,11 @@ public function testChangePassword()
1488
1489
$ visitorCollection ->expects ($ this ->atLeastOnce ())->method ('getItems ' )->willReturn ([$ visitor , $ visitor ]);
1489
1490
$ this ->visitorCollectionFactory ->expects ($ this ->atLeastOnce ())->method ('create ' )
1490
1491
->willReturn ($ visitorCollection );
1491
- $ this ->saveHandler ->expects ($ this ->at (0 ))->method ('destroy ' )->with ('session_id_1 ' );
1492
- $ this ->saveHandler ->expects ($ this ->at (1 ))->method ('destroy ' )->with ('session_id_2 ' );
1492
+ $ this ->saveHandler ->expects ($ this ->atLeastOnce ())->method ('destroy ' )
1493
+ ->withConsecutive (
1494
+ ['session_id_1 ' ],
1495
+ ['session_id_2 ' ]
1496
+ );
1493
1497
1494
1498
$ this ->assertTrue ($ this ->accountManagement ->changePassword ($ email , $ currentPassword , $ newPassword ));
1495
1499
}
@@ -1516,15 +1520,9 @@ function ($string) {
1516
1520
$ this ->customerRegistry ->expects ($ this ->atLeastOnce ())->method ('retrieveSecureData ' )
1517
1521
->willReturn ($ this ->customerSecure );
1518
1522
1519
- $ this ->customerSecure ->expects ($ this ->once ())
1520
- ->method ('setRpToken ' )
1521
- ->with (null );
1522
- $ this ->customerSecure ->expects ($ this ->once ())
1523
- ->method ('setRpTokenCreatedAt ' )
1524
- ->with (null );
1525
- $ this ->customerSecure ->expects ($ this ->any ())
1526
- ->method ('setPasswordHash ' )
1527
- ->willReturn (null );
1523
+ $ this ->customerSecure ->expects ($ this ->once ())->method ('setRpToken ' )->with (null );
1524
+ $ this ->customerSecure ->expects ($ this ->once ())->method ('setRpTokenCreatedAt ' )->with (null );
1525
+ $ this ->customerSecure ->expects ($ this ->any ())->method ('setPasswordHash ' )->willReturn (null );
1528
1526
1529
1527
$ this ->sessionManager ->expects ($ this ->atLeastOnce ())->method ('destroy ' );
1530
1528
$ this ->sessionManager ->expects ($ this ->atLeastOnce ())->method ('start ' );
@@ -1534,8 +1532,8 @@ function ($string) {
1534
1532
->disableOriginalConstructor ()
1535
1533
->setMethods (['getSessionId ' ])
1536
1534
->getMock ();
1537
- $ visitor ->expects ($ this ->at ( 0 ))->method ('getSessionId ' )-> willReturn ( ' session_id_1 ' );
1538
- $ visitor -> expects ( $ this -> at ( 1 ))-> method ( ' getSessionId ' )-> willReturn ( 'session_id_2 ' );
1535
+ $ visitor ->expects ($ this ->atLeastOnce ( ))->method ('getSessionId ' )
1536
+ -> willReturnOnConsecutiveCalls ( ' session_id_1 ' , 'session_id_2 ' );
1539
1537
$ visitorCollection = $ this ->getMockBuilder (
1540
1538
\Magento \Customer \Model \ResourceModel \Visitor \CollectionFactory::class
1541
1539
)
@@ -1544,8 +1542,11 @@ function ($string) {
1544
1542
$ visitorCollection ->expects ($ this ->atLeastOnce ())->method ('getItems ' )->willReturn ([$ visitor , $ visitor ]);
1545
1543
$ this ->visitorCollectionFactory ->expects ($ this ->atLeastOnce ())->method ('create ' )
1546
1544
->willReturn ($ visitorCollection );
1547
- $ this ->saveHandler ->expects ($ this ->at (0 ))->method ('destroy ' )->with ('session_id_1 ' );
1548
- $ this ->saveHandler ->expects ($ this ->at (1 ))->method ('destroy ' )->with ('session_id_2 ' );
1545
+ $ this ->saveHandler ->expects ($ this ->atLeastOnce ())->method ('destroy ' )
1546
+ ->withConsecutive (
1547
+ ['session_id_1 ' ],
1548
+ ['session_id_2 ' ]
1549
+ );
1549
1550
$ this ->assertTrue ($ this ->accountManagement ->resetPassword ($ customerEmail , $ resetToken , $ newPassword ));
1550
1551
}
1551
1552
@@ -1624,10 +1625,10 @@ public function testAuthenticate()
1624
1625
->withConsecutive (
1625
1626
[
1626
1627
'customer_customer_authenticated ' ,
1627
- ['model ' => $ customerModel , 'password ' => $ password ]
1628
+ ['model ' => $ customerModel , 'password ' => $ password ],
1628
1629
],
1629
1630
[
1630
- 'customer_data_object_login ' , ['customer ' => $ customerData ]
1631
+ 'customer_data_object_login ' , ['customer ' => $ customerData ],
1631
1632
]
1632
1633
);
1633
1634
0 commit comments