Skip to content

Commit 719c3e8

Browse files
committed
[Security] deprecate the RoleInterface
1 parent 8bb6c39 commit 719c3e8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Tests/Firewall/SwitchUserListenerTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Http\Tests\Firewall;
1313

14+
use Symfony\Component\Security\Core\Role\Role;
1415
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
1516
use Symfony\Component\Security\Http\Firewall\SwitchUserListener;
1617
use Symfony\Component\Security\Http\SecurityEvents;
@@ -66,7 +67,7 @@ public function testEventIsIgnoredIfUsernameIsNotPassedWithTheRequest()
6667
*/
6768
public function testExitUserThrowsAuthenticationExceptionIfOriginalTokenCannotBeFound()
6869
{
69-
$token = $this->getToken(array($this->getMock('Symfony\Component\Security\Core\Role\RoleInterface')));
70+
$token = $this->getToken(array(new Role('the role')));
7071

7172
$this->tokenStorage->expects($this->any())->method('getToken')->will($this->returnValue($token));
7273
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue('_exit'));
@@ -216,7 +217,7 @@ public function testExitUserDoesNotDispatchEventWithStringUser()
216217
*/
217218
public function testSwitchUserIsDisallowed()
218219
{
219-
$token = $this->getToken(array($this->getMock('Symfony\Component\Security\Core\Role\RoleInterface')));
220+
$token = $this->getToken(array(new Role('the role')));
220221

221222
$this->tokenStorage->expects($this->any())->method('getToken')->will($this->returnValue($token));
222223
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue('kuba'));
@@ -231,7 +232,7 @@ public function testSwitchUserIsDisallowed()
231232

232233
public function testSwitchUser()
233234
{
234-
$token = $this->getToken(array($this->getMock('Symfony\Component\Security\Core\Role\RoleInterface')));
235+
$token = $this->getToken(array(new Role('the role')));
235236
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
236237
$user->expects($this->any())->method('getRoles')->will($this->returnValue(array()));
237238

@@ -261,7 +262,7 @@ public function testSwitchUser()
261262

262263
public function testSwitchUserKeepsOtherQueryStringParameters()
263264
{
264-
$token = $this->getToken(array($this->getMock('Symfony\Component\Security\Core\Role\RoleInterface')));
265+
$token = $this->getToken(array(new Role('the role')));
265266
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
266267
$user->expects($this->any())->method('getRoles')->will($this->returnValue(array()));
267268

0 commit comments

Comments
 (0)