@@ -114,7 +114,7 @@ public function isLoggedInData() {
114
114
* @dataProvider isLoggedInData
115
115
*/
116
116
public function testIsLoggedIn ($ isLoggedIn ) {
117
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
117
+ $ session = $ this ->createMock (Memory::class);
118
118
119
119
$ manager = $ this ->createMock (Manager::class);
120
120
@@ -132,7 +132,7 @@ public function testIsLoggedIn($isLoggedIn) {
132
132
}
133
133
134
134
public function testSetUser () {
135
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
135
+ $ session = $ this ->createMock (Memory::class);
136
136
$ session ->expects ($ this ->once ())
137
137
->method ('set ' )
138
138
->with ('user_id ' , 'foo ' );
@@ -151,7 +151,7 @@ public function testSetUser() {
151
151
}
152
152
153
153
public function testLoginValidPasswordEnabled () {
154
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
154
+ $ session = $ this ->createMock (Memory::class);
155
155
$ session ->expects ($ this ->once ())
156
156
->method ('regenerateId ' );
157
157
$ this ->tokenProvider ->expects ($ this ->once ())
@@ -228,7 +228,7 @@ public function testLoginValidPasswordEnabled() {
228
228
public function testLoginValidPasswordDisabled () {
229
229
$ this ->expectException (LoginException::class);
230
230
231
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
231
+ $ session = $ this ->createMock (Memory::class);
232
232
$ session ->expects ($ this ->never ())
233
233
->method ('set ' );
234
234
$ session ->expects ($ this ->once ())
@@ -270,7 +270,7 @@ public function testLoginValidPasswordDisabled() {
270
270
}
271
271
272
272
public function testLoginInvalidPassword () {
273
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
273
+ $ session = $ this ->createMock (Memory::class);
274
274
$ managerMethods = get_class_methods (Manager::class);
275
275
//keep following methods intact in order to ensure hooks are working
276
276
$ mockedManagerMethods = array_diff ($ managerMethods , ['__construct ' , 'emit ' , 'listen ' ]);
@@ -313,7 +313,7 @@ public function testLoginInvalidPassword() {
313
313
}
314
314
315
315
public function testPasswordlessLoginNoLastCheckUpdate (): void {
316
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
316
+ $ session = $ this ->createMock (Memory::class);
317
317
$ managerMethods = get_class_methods (Manager::class);
318
318
// Keep following methods intact in order to ensure hooks are working
319
319
$ mockedManagerMethods = array_diff ($ managerMethods , ['__construct ' , 'emit ' , 'listen ' ]);
@@ -350,7 +350,7 @@ public function testPasswordlessLoginNoLastCheckUpdate(): void {
350
350
}
351
351
352
352
public function testLoginLastCheckUpdate (): void {
353
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
353
+ $ session = $ this ->createMock (Memory::class);
354
354
$ managerMethods = get_class_methods (Manager::class);
355
355
// Keep following methods intact in order to ensure hooks are working
356
356
$ mockedManagerMethods = array_diff ($ managerMethods , ['__construct ' , 'emit ' , 'listen ' ]);
@@ -387,7 +387,7 @@ public function testLoginLastCheckUpdate(): void {
387
387
}
388
388
389
389
public function testLoginNonExisting () {
390
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
390
+ $ session = $ this ->createMock (Memory::class);
391
391
$ manager = $ this ->createMock (Manager::class);
392
392
$ userSession = new Session ($ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher );
393
393
@@ -607,7 +607,7 @@ public function testTryTokenLoginSessionIdTokenNotFound(): void {
607
607
}
608
608
609
609
public function testRememberLoginValidToken () {
610
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
610
+ $ session = $ this ->createMock (Memory::class);
611
611
$ managerMethods = get_class_methods (Manager::class);
612
612
//keep following methods intact in order to ensure hooks are working
613
613
$ mockedManagerMethods = array_diff ($ managerMethods , ['__construct ' , 'emit ' , 'listen ' ]);
@@ -696,7 +696,7 @@ public function testRememberLoginValidToken() {
696
696
}
697
697
698
698
public function testRememberLoginInvalidSessionToken () {
699
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
699
+ $ session = $ this ->createMock (Memory::class);
700
700
$ managerMethods = get_class_methods (Manager::class);
701
701
//keep following methods intact in order to ensure hooks are working
702
702
$ mockedManagerMethods = array_diff ($ managerMethods , ['__construct ' , 'emit ' , 'listen ' ]);
@@ -760,7 +760,7 @@ public function testRememberLoginInvalidSessionToken() {
760
760
}
761
761
762
762
public function testRememberLoginInvalidToken () {
763
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
763
+ $ session = $ this ->createMock (Memory::class);
764
764
$ managerMethods = get_class_methods (Manager::class);
765
765
//keep following methods intact in order to ensure hooks are working
766
766
$ mockedManagerMethods = array_diff ($ managerMethods , ['__construct ' , 'emit ' , 'listen ' ]);
@@ -812,7 +812,7 @@ public function testRememberLoginInvalidToken() {
812
812
}
813
813
814
814
public function testRememberLoginInvalidUser () {
815
- $ session = $ this ->getMockBuilder (Memory::class)-> setConstructorArgs ([ '' ])-> getMock ( );
815
+ $ session = $ this ->createMock (Memory::class);
816
816
$ managerMethods = get_class_methods (Manager::class);
817
817
//keep following methods intact in order to ensure hooks are working
818
818
$ mockedManagerMethods = array_diff ($ managerMethods , ['__construct ' , 'emit ' , 'listen ' ]);
@@ -872,7 +872,7 @@ public function testActiveUserAfterSetSession() {
872
872
return $ users [$ uid ];
873
873
});
874
874
875
- $ session = new Memory ('' );
875
+ $ session = new Memory ();
876
876
$ session ->set ('user_id ' , 'foo ' );
877
877
$ userSession = $ this ->getMockBuilder (Session::class)
878
878
->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
@@ -885,7 +885,7 @@ public function testActiveUserAfterSetSession() {
885
885
886
886
$ this ->assertEquals ($ users ['foo ' ], $ userSession ->getUser ());
887
887
888
- $ session2 = new Memory ('' );
888
+ $ session2 = new Memory ();
889
889
$ session2 ->set ('user_id ' , 'bar ' );
890
890
$ userSession ->setSession ($ session2 );
891
891
$ this ->assertEquals ($ users ['bar ' ], $ userSession ->getUser ());
0 commit comments