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:
Nicolas Grekas 2016-03-25 16:39:22 +01:00
commit c1ca48765e
2 changed files with 16 additions and 12 deletions

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Acl\Tests\Domain
{
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use Symfony\Component\Security\Acl\Model\DomainObjectInterface;
class ObjectIdentityTest extends \PHPUnit_Framework_TestCase
{
@ -34,17 +35,7 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
public function testFromDomainObjectPrefersInterfaceOverGetId()
{
$domainObject = $this->getMock('Symfony\Component\Security\Acl\Model\DomainObjectInterface');
$domainObject
->expects($this->once())
->method('getObjectIdentifier')
->will($this->returnValue('getObjectIdentifier()'))
;
$domainObject
->expects($this->never())
->method('getId')
->will($this->returnValue('getId()'))
;
$domainObject = new DomainObjectImplementation();
$id = ObjectIdentity::fromDomainObject($domainObject);
$this->assertEquals('getObjectIdentifier()', $id->getIdentifier());
@ -121,6 +112,19 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
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

View File

@ -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->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->handle($this->event);