Merge branch '2.3' into 2.7
* 2.3: fix mocks Conflicts: src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
This commit is contained in:
commit
c1ca48765e
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\Security\Acl\Tests\Domain
|
namespace Symfony\Component\Security\Acl\Tests\Domain
|
||||||
{
|
{
|
||||||
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
|
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
|
||||||
|
use Symfony\Component\Security\Acl\Model\DomainObjectInterface;
|
||||||
|
|
||||||
class ObjectIdentityTest extends \PHPUnit_Framework_TestCase
|
class ObjectIdentityTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -34,17 +35,7 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
|
|||||||
|
|
||||||
public function testFromDomainObjectPrefersInterfaceOverGetId()
|
public function testFromDomainObjectPrefersInterfaceOverGetId()
|
||||||
{
|
{
|
||||||
$domainObject = $this->getMock('Symfony\Component\Security\Acl\Model\DomainObjectInterface');
|
$domainObject = new DomainObjectImplementation();
|
||||||
$domainObject
|
|
||||||
->expects($this->once())
|
|
||||||
->method('getObjectIdentifier')
|
|
||||||
->will($this->returnValue('getObjectIdentifier()'))
|
|
||||||
;
|
|
||||||
$domainObject
|
|
||||||
->expects($this->never())
|
|
||||||
->method('getId')
|
|
||||||
->will($this->returnValue('getId()'))
|
|
||||||
;
|
|
||||||
|
|
||||||
$id = ObjectIdentity::fromDomainObject($domainObject);
|
$id = ObjectIdentity::fromDomainObject($domainObject);
|
||||||
$this->assertEquals('getObjectIdentifier()', $id->getIdentifier());
|
$this->assertEquals('getObjectIdentifier()', $id->getIdentifier());
|
||||||
@ -121,6 +112,19 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
|
|||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DomainObjectImplementation implements DomainObjectInterface
|
||||||
|
{
|
||||||
|
public function getObjectIdentifier()
|
||||||
|
{
|
||||||
|
return 'getObjectIdentifier()';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return 'getId()';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Acl\Tests\Domain
|
namespace Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Acl\Tests\Domain
|
||||||
|
@ -55,7 +55,7 @@ class SwitchUserListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue(null));
|
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue(null));
|
||||||
|
|
||||||
$this->event->expects($this->never())->method('setResponse');
|
$this->event->expects($this->never())->method('setResponse');
|
||||||
$this->tokenStorage->expects($this->never())->method('setToken');
|
$this->securityContext->expects($this->never())->method('setToken');
|
||||||
|
|
||||||
$listener = new SwitchUserListener($this->tokenStorage, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager);
|
$listener = new SwitchUserListener($this->tokenStorage, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager);
|
||||||
$listener->handle($this->event);
|
$listener->handle($this->event);
|
||||||
|
Reference in New Issue
Block a user