summaryrefslogtreecommitdiffstats
path: root/Http/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Http/Tests')
-rw-r--r--Http/Tests/Firewall/SwitchUserListenerTest.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/Http/Tests/Firewall/SwitchUserListenerTest.php b/Http/Tests/Firewall/SwitchUserListenerTest.php
index b80f8c6..920163a 100644
--- a/Http/Tests/Firewall/SwitchUserListenerTest.php
+++ b/Http/Tests/Firewall/SwitchUserListenerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Security\Http\Tests\Firewall;
+use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
use Symfony\Component\Security\Http\Firewall\SwitchUserListener;
use Symfony\Component\Security\Http\SecurityEvents;
@@ -66,7 +67,7 @@ class SwitchUserListenerTest extends \PHPUnit_Framework_TestCase
*/
public function testExitUserThrowsAuthenticationExceptionIfOriginalTokenCannotBeFound()
{
- $token = $this->getToken(array($this->getMockBuilder('Symfony\Component\Security\Core\Role\RoleInterface')->getMock()));
+ $token = $this->getToken(array(new Role('the role')));
$this->tokenStorage->expects($this->any())->method('getToken')->will($this->returnValue($token));
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue('_exit'));
@@ -216,7 +217,7 @@ class SwitchUserListenerTest extends \PHPUnit_Framework_TestCase
*/
public function testSwitchUserIsDisallowed()
{
- $token = $this->getToken(array($this->getMockBuilder('Symfony\Component\Security\Core\Role\RoleInterface')->getMock()));
+ $token = $this->getToken(array(new Role('the role')));
$this->tokenStorage->expects($this->any())->method('getToken')->will($this->returnValue($token));
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue('kuba'));
@@ -231,8 +232,8 @@ class SwitchUserListenerTest extends \PHPUnit_Framework_TestCase
public function testSwitchUser()
{
- $token = $this->getToken(array($this->getMockBuilder('Symfony\Component\Security\Core\Role\RoleInterface')->getMock()));
- $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $token = $this->getToken(array(new Role('the role')));
+ $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$user->expects($this->any())->method('getRoles')->will($this->returnValue(array()));
$this->tokenStorage->expects($this->any())->method('getToken')->will($this->returnValue($token));
@@ -261,8 +262,8 @@ class SwitchUserListenerTest extends \PHPUnit_Framework_TestCase
public function testSwitchUserKeepsOtherQueryStringParameters()
{
- $token = $this->getToken(array($this->getMockBuilder('Symfony\Component\Security\Core\Role\RoleInterface')->getMock()));
- $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
+ $token = $this->getToken(array(new Role('the role')));
+ $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$user->expects($this->any())->method('getRoles')->will($this->returnValue(array()));
$this->tokenStorage->expects($this->any())->method('getToken')->will($this->returnValue($token));