11
11
12
12
namespace Symfony \Component \Security \Http \Tests \Firewall ;
13
13
14
+ use Symfony \Component \Security \Core \Role \Role ;
14
15
use Symfony \Component \Security \Http \Event \SwitchUserEvent ;
15
16
use Symfony \Component \Security \Http \Firewall \SwitchUserListener ;
16
17
use Symfony \Component \Security \Http \SecurityEvents ;
@@ -66,7 +67,7 @@ public function testEventIsIgnoredIfUsernameIsNotPassedWithTheRequest()
66
67
*/
67
68
public function testExitUserThrowsAuthenticationExceptionIfOriginalTokenCannotBeFound ()
68
69
{
69
- $ token = $ this ->getToken (array ($ this -> getMock ( ' Symfony\Component\Security\Core\Role\RoleInterface ' )));
70
+ $ token = $ this ->getToken (array (new Role ( ' the role ' )));
70
71
71
72
$ this ->tokenStorage ->expects ($ this ->any ())->method ('getToken ' )->will ($ this ->returnValue ($ token ));
72
73
$ this ->request ->expects ($ this ->any ())->method ('get ' )->with ('_switch_user ' )->will ($ this ->returnValue ('_exit ' ));
@@ -216,7 +217,7 @@ public function testExitUserDoesNotDispatchEventWithStringUser()
216
217
*/
217
218
public function testSwitchUserIsDisallowed ()
218
219
{
219
- $ token = $ this ->getToken (array ($ this -> getMock ( ' Symfony\Component\Security\Core\Role\RoleInterface ' )));
220
+ $ token = $ this ->getToken (array (new Role ( ' the role ' )));
220
221
221
222
$ this ->tokenStorage ->expects ($ this ->any ())->method ('getToken ' )->will ($ this ->returnValue ($ token ));
222
223
$ this ->request ->expects ($ this ->any ())->method ('get ' )->with ('_switch_user ' )->will ($ this ->returnValue ('kuba ' ));
@@ -231,7 +232,7 @@ public function testSwitchUserIsDisallowed()
231
232
232
233
public function testSwitchUser ()
233
234
{
234
- $ token = $ this ->getToken (array ($ this -> getMock ( ' Symfony\Component\Security\Core\Role\RoleInterface ' )));
235
+ $ token = $ this ->getToken (array (new Role ( ' the role ' )));
235
236
$ user = $ this ->getMock ('Symfony\Component\Security\Core\User\UserInterface ' );
236
237
$ user ->expects ($ this ->any ())->method ('getRoles ' )->will ($ this ->returnValue (array ()));
237
238
@@ -261,7 +262,7 @@ public function testSwitchUser()
261
262
262
263
public function testSwitchUserKeepsOtherQueryStringParameters ()
263
264
{
264
- $ token = $ this ->getToken (array ($ this -> getMock ( ' Symfony\Component\Security\Core\Role\RoleInterface ' )));
265
+ $ token = $ this ->getToken (array (new Role ( ' the role ' )));
265
266
$ user = $ this ->getMock ('Symfony\Component\Security\Core\User\UserInterface ' );
266
267
$ user ->expects ($ this ->any ())->method ('getRoles ' )->will ($ this ->returnValue (array ()));
267
268
0 commit comments