8000 Merge branch '2.3' into 2.7 · symfony/symfony@c1ca487 · GitHub
[go: up one dir, main page]

Skip to content

Commit c1ca487

Browse files
Merge branch '2.3' into 2.7
* 2.3: fix mocks Conflicts: src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
2 parents 0cd725e + 37dd041 commit c1ca487

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/Symfony/Component/Security/Acl/Tests/Domain/ObjectIdentityTest.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Security\Acl\Tests\Domain
1313
{
1414
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
15+
use Symfony\Component\Security\Acl\Model\DomainObjectInterface;
1516

1617
class ObjectIdentityTest extends \PHPUnit_Framework_TestCase
1718
{
@@ -34,17 +35,7 @@ public function testConstructorWithProxy()
3435

3536
public function testFromDomainObjectPrefersInterfaceOverGetId()
3637
{
37-
$domainObject = $this->getMock('Symfony\Component\Security\Acl\Model\DomainObjectInterface');
38-
$domainObject
39-
->expects($this->once())
40-
->method('getObjectIdentifier')
41-
->will($this->returnValue('getObjectIdentifier()'))
42-
;
43-
$domainObject
44-
->expects($this->never())
45-
->method('getId')
46-
->will($this->returnValue('getId()'))
47-
;
38+
$domainObject = new DomainObjectImplementation();
4839

4940
$id = ObjectIdentity::fromDomainObject($domainObject);
5041
$this->assertEquals('getObjectIdentifier()', $id->getIdentifier());
@@ -121,6 +112,19 @@ public function getId()
121112
return $this->id;
122113
}
123114
}
115+
116+
class DomainObjectImplementation implements DomainObjectInterface
117+
{
118+
public function getObjectIdentifier()
119+
{
120+
return 'getObjectIdentifier()';
121+
}
122+
123+
public function getId()
124+
{
125+
return 'getId()';
126+
}
127+
}
124128
}
125129

126130
namespace Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Acl\Tests\Domain

src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testEventIsIgnoredIfUsernameIsNotPassedWithTheRequest()
5555
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue(null));
5656

5757
$this->event->expects($this->never())->method('setResponse');
58-
$this->tokenStorage->expects($this->never())->method('setToken');
58+
$this->securityContext->expects($this->never())->method('setToken');
5959

6060
$listener = new SwitchUserListener($this->tokenStorage, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager);
6161
$listener->handle($this->event);

0 commit comments

Comments
 (0)
0