22
22
use Symfony \Component \Security \Core \Authentication \Token \AnonymousToken ;
23
23
use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorage ;
24
24
use Symfony \Component \Security \Core \Authentication \Token \UsernamePasswordToken ;
25
- use Symfony \Component \Security \Core \User \UserProviderInterface ;
26
25
use Symfony \Component \Security \Http \Firewall \ContextListener ;
27
26
use Symfony \Component \EventDispatcher \EventDispatcher ;
28
27
@@ -36,13 +35,12 @@ public function testItRequiresContextKey()
36
35
{
37
36
new ContextListener (
38
37
$ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' )->getMock (),
39
- $ this -> getMockBuilder (UserProviderInterface::class)-> getMock (),
38
+ array (),
40
39
''
41
40
);
42
41
}
43
42
44
43
/**
45
- * @group legacy
46
44
* @expectedException \InvalidArgumentException
47
45
* @expectedExceptionMessage User provider "stdClass" must implement "Symfony\Component\Security\Core\User\UserProviderInterface
48
46
*/
@@ -111,7 +109,7 @@ public function testOnKernelResponseWithoutSession()
111
109
new Response ()
112
110
);
113
111
114
- $ listener = new ContextListener ($ tokenStorage , $ this -> getMockBuilder (UserProviderInterface::class)-> getMock (), 'session ' , null , new EventDispatcher ());
112
+ $ listener = new ContextListener ($ tokenStorage , array (), 'session ' , null , new EventDispatcher ());
115
113
$ listener ->onKernelResponse ($ event );
116
114
117
115
$ this ->assertTrue ($ session ->isStarted ());
@@ -130,7 +128,7 @@ public function testOnKernelResponseWithoutSessionNorToken()
130
128
new Response ()
131
129
);
132
130
133
- $ listener = new ContextListener (new TokenStorage (), $ this -> getMockBuilder (UserProviderInterface::class)-> getMock (), 'session ' , null , new EventDispatcher ());
131
+ $ listener = new ContextListener (new TokenStorage (), array (), 'session ' , null , new EventDispatcher ());
134
132
$ listener ->onKernelResponse ($ event );
135
133
136
134
$ this ->assertFalse ($ session ->isStarted ());
@@ -165,7 +163,7 @@ public function testInvalidTokenInSession($token)
165
163
->method ('setToken ' )
166
164
->with (null );
167
165
168
- $ listener = new ContextListener ($ tokenStorage , $ this -> getMockBuilder (UserProviderInterface::class)-> getMock (), 'key123 ' );
166
+ $ listener = new ContextListener ($ tokenStorage , array (), 'key123 ' );
169
167
$ listener ->handle ($ event );
170
168
}
171
169
@@ -186,7 +184,7 @@ public function testHandleAddsKernelResponseListener()
186
184
->disableOriginalConstructor ()
187
185
->getMock ();
188
186
189
- $ listener = new ContextListener ($ tokenStorage , $ this -> getMockBuilder (UserProviderInterface::class)-> getMock (), 'key123 ' , null , $ dispatcher );
187
+ $ listener = new ContextListener ($ tokenStorage , array (), 'key123 ' , null , $ dispatcher );
190
188
191
189
$ event ->expects ($ this ->any ())
192
190
->method ('isMasterRequest ' )
@@ -210,7 +208,7 @@ public function testOnKernelResponseListenerRemovesItself()
210
208
->disableOriginalConstructor ()
211
209
->getMock ();
212
210
213
- $ listener = new ContextListener ($ tokenStorage , $ this -> getMockBuilder (UserProviderInterface::class)-> getMock (), 'key123 ' , null , $ dispatcher );
211
+ $ listener = new ContextListener ($ tokenStorage , array (), 'key123 ' , null , $ dispatcher );
214
212
215
213
$ request = $ this ->getMockBuilder ('Symfony\Component\HttpFoundation\Request ' )->getMock ();
216
214
$ request ->expects ($ this ->any ())
@@ -244,7 +242,7 @@ public function testHandleRemovesTokenIfNoPreviousSessionWasFound()
244
242
$ tokenStorage = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' )->getMock ();
245
243
$ tokenStorage ->expects ($ this ->once ())->method ('setToken ' )->with (null );
246
244
247
- $ listener = new ContextListener ($ tokenStorage , $ this -> getMockBuilder (UserProviderInterface::class)-> getMock (), 'key123 ' );
245
+ $ listener = new ContextListener ($ tokenStorage , array (), 'key123 ' );
248
246
$ listener ->handle ($ event );
249
247
}
250
248
@@ -270,7 +268,7 @@ protected function runSessionOnKernelResponse($newToken, $original = null)
270
268
new Response ()
271
269
);
272
270
273
- $ listener = new ContextListener ($ tokenStorage , $ this -> getMockBuilder (UserProviderInterface::class)-> getMock (), 'session ' , null , new EventDispatcher ());
271
+ $ listener = new ContextListener ($ tokenStorage , array (), 'session ' , null , new EventDispatcher ());
274
272
$ listener ->onKernelResponse ($ event );
275
273
276
274
return $ session ;
0 commit comments