@@ -36,14 +36,14 @@ public static function setUpBeforeClass()
36
36
37
37
public function testAutoLoginReturnsNullWhenNoCookie ()
38
38
{
39
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' ) );
39
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' ] );
40
40
41
41
$ this ->assertNull ($ service ->autoLogin (new Request ()));
42
42
}
43
43
44
44
public function testAutoLoginThrowsExceptionOnInvalidCookie ()
45
45
{
46
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => false , 'remember_me_parameter ' => 'foo ' ) );
46
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => false , 'remember_me_parameter ' => 'foo ' ] );
47
47
$ request = new Request ();
48
48
$ request ->request ->set ('foo ' , 'true ' );
49
49
$ request ->cookies ->set ('foo ' , 'foo ' );
@@ -54,13 +54,13 @@ public function testAutoLoginThrowsExceptionOnInvalidCookie()
54
54
55
55
public function testAutoLoginThrowsExceptionOnNonExistentToken ()
56
56
{
57
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => false , 'remember_me_parameter ' => 'foo ' ) );
57
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => false , 'remember_me_parameter ' => 'foo ' ] );
58
58
$ request = new Request ();
59
59
$ request ->request ->set ('foo ' , 'true ' );
60
- $ request ->cookies ->set ('foo ' , $ this ->encodeCookie (array (
60
+ $ request ->cookies ->set ('foo ' , $ this ->encodeCookie ([
61
61
$ series = 'fooseries ' ,
62
62
$ tokenValue = 'foovalue ' ,
63
- ) ));
63
+ ] ));
64
64
65
65
$ tokenProvider = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface ' )->getMock ();
66
66
$ tokenProvider
@@ -77,9 +77,9 @@ public function testAutoLoginThrowsExceptionOnNonExistentToken()
77
77
public function testAutoLoginReturnsNullOnNonExistentUser ()
78
78
{
79
79
$ userProvider = $ this ->getProvider ();
80
- $ service = $ this ->getService ($ userProvider , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => true , 'lifetime ' => 3600 , 'secure ' => false , 'httponly ' => false ) );
80
+ $ service = $ this ->getService ($ userProvider , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => true , 'lifetime ' => 3600 , 'secure ' => false , 'httponly ' => false ] );
81
81
$ request = new Request ();
82
- $ request ->cookies ->set ('foo ' , $ this ->encodeCookie (array ( 'fooseries ' , 'foovalue ' ) ));
82
+ $ request ->cookies ->set ('foo ' , $ this ->encodeCookie ([ 'fooseries ' , 'foovalue ' ] ));
83
83
84
84
$ tokenProvider = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface ' )->getMock ();
85
85
$ tokenProvider
@@ -102,9 +102,9 @@ public function testAutoLoginReturnsNullOnNonExistentUser()
102
102
public function testAutoLoginThrowsExceptionOnStolenCookieAndRemovesItFromThePersistentBackend ()
103
103
{
104
104
$ userProvider = $ this ->getProvider ();
105
- $ service = $ this ->getService ($ userProvider , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => true ) );
105
+ $ service = $ this ->getService ($ userProvider , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => true ] );
106
106
$ request = new Request ();
107
- $ request ->cookies ->set ('foo ' , $ this ->encodeCookie (array ( 'fooseries ' , 'foovalue ' ) ));
107
+ $ request ->cookies ->set ('foo ' , $ this ->encodeCookie ([ 'fooseries ' , 'foovalue ' ] ));
108
108
109
109
$ tokenProvider = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface ' )->getMock ();
110
110
$ service ->setTokenProvider ($ tokenProvider );
@@ -133,9 +133,9 @@ public function testAutoLoginThrowsExceptionOnStolenCookieAndRemovesItFromThePer
133
133
134
134
public function testAutoLoginDoesNotAcceptAnExpiredCookie ()
135
135
{
136
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => true , 'lifetime ' => 3600 ) );
136
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'always_remember_me ' => true , 'lifetime ' => 3600 ] );
137
137
$ request = new Request ();
138
- $ request ->cookies ->set ('foo ' , $ this ->encodeCookie (array ( 'fooseries ' , 'foovalue ' ) ));
138
+ $ request ->cookies ->set ('foo ' , $ this ->encodeCookie ([ 'fooseries ' , 'foovalue ' ] ));
139
139
140
140
$ tokenProvider = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface ' )->getMock ();
141
141
$ tokenProvider
@@ -156,7 +156,7 @@ public function testAutoLogin()
156
156
$ user
157
157
->expects ($ this ->once ())
158
158
->method ('getRoles ' )
159
- ->will ($ this ->returnValue (array ( 'ROLE_FOO ' ) ))
159
+ ->will ($ this ->returnValue ([ 'ROLE_FOO ' ] ))
160
160
;
161
161
162
162
$ userProvider = $ this ->getProvider ();
@@ -167,9 +167,9 @@ public function testAutoLogin()
167
167
->will ($ this ->returnValue ($ user ))
168
168
;
169
169
170
- $ service = $ this ->getService ($ userProvider , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'secure ' => false , 'httponly ' => false , 'always_remember_me ' => true , 'lifetime ' => 3600 ) );
170
+ $ service = $ this ->getService ($ userProvider , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null , 'secure ' => false , 'httponly ' => false , 'always_remember_me ' => true , 'lifetime ' => 3600 ] );
171
171
$ request = new Request ();
172
- $ request ->cookies ->set ('foo ' , $ this ->encodeCookie (array ( 'fooseries ' , 'foovalue ' ) ));
172
+ $ request ->cookies ->set ('foo ' , $ this ->encodeCookie ([ 'fooseries ' , 'foovalue ' ] ));
173
173
174
174
$ tokenProvider = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface ' )->getMock ();
175
175
$ tokenProvider
@@ -190,9 +190,9 @@ public function testAutoLogin()
190
190
191
191
public function testLogout ()
192
192
{
193
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' , 'path ' => '/foo ' , 'domain ' => 'foodomain.foo ' , 'secure ' => true , 'httponly ' => false ) );
193
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' , 'path ' => '/foo ' , 'domain ' => 'foodomain.foo ' , 'secure ' => true , 'httponly ' => false ] );
194
194
$ request = new Request ();
195
- $ request ->cookies ->set ('foo ' , $ this ->encodeCookie (array ( 'fooseries ' , 'foovalue ' ) ));
195
+ $ request ->cookies ->set ('foo ' , $ this ->encodeCookie ([ 'fooseries ' , 'foovalue ' ] ));
196
196
$ response = new Response ();
197
197
$ token = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )->getMock ();
198
198
@@ -217,7 +217,7 @@ public function testLogout()
217
217
218
218
public function testLogoutSimplyIgnoresNonSetRequestCookie ()
219
219
{
220
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null ) );
220
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null ] );
221
221
$ request = new Request ();
222
222
$ response = new Response ();
223
223
$ token = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )->getMock ();
@@ -239,7 +239,7 @@ public function testLogoutSimplyIgnoresNonSetRequestCookie()
239
239
240
240
public function testLogoutSimplyIgnoresInvalidCookie ()
241
241
{
242
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null ) );
242
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null ] );
243
243
$ request = new Request ();
244
244
$ request ->cookies ->set ('foo ' , 'somefoovalue ' );
245
245
$ response = new Response ();
@@ -259,7 +259,7 @@ public function testLogoutSimplyIgnoresInvalidCookie()
259
259
260
260
public function testLoginFail ()
261
261
{
262
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' , 'path ' => null , 'domain ' => null ) );
262
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' , 'path ' => null , 'domain ' => null ] );
263
263
$ request = new Request ();
264
264
265
265
$ this ->assertFalse ($ request ->attributes ->has (RememberMeServicesInterface::COOKIE_ATTR_NAME ));
@@ -269,7 +269,7 @@ public function testLoginFail()
269
269
270
270
public function testLoginSuccessSetsCookieWhenLoggedInWithNonRememberMeTokenInterfaceImplementation ()
271
271
{
272
- $ service = $ this ->getService (null , array ( 'name ' => 'foo ' , 'domain ' => 'myfoodomain.foo ' , 'path ' => '/foo/path ' , 'secure ' => true , 'httponly ' => true , 'samesite ' => Cookie::SAMESITE_STRICT , 'lifetime ' => 3600 , 'always_remember_me ' => true ) );
272
+ $ service = $ this ->getService (null , [ 'name ' => 'foo ' , 'domain ' => 'myfoodomain.foo ' , 'path ' => '/foo/path ' , 'secure ' => true , 'httponly ' => true , 'samesite ' => Cookie::SAMESITE_STRICT , 'lifetime ' => 3600 , 'always_remember_me ' => true ] );
273
273
$ request = new Request ();
274
274
$ response = new Response ();
275
275
@@ -318,13 +318,13 @@ protected function encodeCookie(array $parts)
318
318
return $ r ->invoke ($ service , $ parts );
319
319
}
320
320
321
- protected function getService ($ userProvider = null , $ options = array () , $ logger = null )
321
+ protected function getService ($ userProvider = null , $ options = [] , $ logger = null )
322
322
{
323
323
if (null === $ userProvider ) {
324
324
$ userProvider = $ this ->getProvider ();
325
325
}
326
326
327
- return new PersistentTokenBasedRememberMeServices (array ( $ userProvider) , 'foosecret ' , 'fookey ' , $ options , $ logger );
327
+ return new PersistentTokenBasedRememberMeServices ([ $ userProvider] , 'foosecret ' , 'fookey ' , $ options , $ logger );
328
328
}
329
329
330
330
protected function getProvider ()
0 commit comments