8000 minor #18306 [2.3] fix mocks (xabbuh) · symfony/symfony@37dd041 · GitHub
[go: up one dir, main page]

Skip to content

Commit 37dd041

Browse files
minor #18306 [2.3] fix mocks (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- [2.3] fix mocks | Q | A | ------------- | --- | Branch? | 2.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | * fix a typo in a method name (`setResponse` instead of `seetResopnse`) * fix mocking a method that is not part of the `DomainObjectInterface` Commits ------- c211523 fix mocks
2 parents 89f1c35 + c211523 commit 37dd041

File tree

3 files changed

+17
8000
-13
lines changed

3 files changed

+17
-13
lines changed

phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// Please update when phpunit needs to be reinstalled with fresh deps:
14-
// Cache-Id-Version: 2016-03-23 14:50 UTC
14+
// Cache-Id-Version: 2016-03-25 09:45 UTC
1515

1616
use Symfony\Component\Process\ProcessUtils;
1717

src/Symfony/Component/Security/Tests/Acl/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\Tests\Acl\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\Tests\Acl\Domain

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

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

56-
$this->event->expects($this->never())->method('setResopnse');
56+
$this->event->expects($this->never())->method('setResponse');
5757
$this->securityContext->expects($this->never())->method('setToken');
5858

5959
$listener = new SwitchUserListener($this->securityContext, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager);

0 commit comments

Comments
 (0)
0