From c211523f6ea7738a58fbda0fc0b1c01de5c88272 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 25 Mar 2016 09:55:34 +0100 Subject: [PATCH] fix mocks * fix a typo in a method name (`setResponse` instead of `seetResopnse`) * fix mocking a method that is not part of the `DomainObjectInterface` --- phpunit | 2 +- .../Tests/Acl/Domain/ObjectIdentityTest.php | 26 +++++++++++-------- .../Http/Firewall/SwitchUserListenerTest.php | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/phpunit b/phpunit index 413e7d0ba4..d2da42616d 100755 --- a/phpunit +++ b/phpunit @@ -11,7 +11,7 @@ */ // Please update when phpunit needs to be reinstalled with fresh deps: -// Cache-Id-Version: 2016-03-23 14:50 UTC +// Cache-Id-Version: 2016-03-25 09:45 UTC use Symfony\Component\Process\ProcessUtils; diff --git a/src/Symfony/Component/Security/Tests/Acl/Domain/ObjectIdentityTest.php b/src/Symfony/Component/Security/Tests/Acl/Domain/ObjectIdentityTest.php index 111ae8a984..312f4336e2 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Domain/ObjectIdentityTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Domain/ObjectIdentityTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Security\Tests\Acl\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\Tests\Acl\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\Tests\Acl\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\Tests\Acl\Domain diff --git a/src/Symfony/Component/Security/Tests/Http/Firewall/SwitchUserListenerTest.php b/src/Symfony/Component/Security/Tests/Http/Firewall/SwitchUserListenerTest.php index 7ba71d42c3..18527518ca 100644 --- a/src/Symfony/Component/Security/Tests/Http/Firewall/SwitchUserListenerTest.php +++ b/src/Symfony/Component/Security/Tests/Http/Firewall/SwitchUserListenerTest.php @@ -53,7 +53,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('setResopnse'); + $this->event->expects($this->never())->method('setResponse'); $this->securityContext->expects($this->never())->method('setToken'); $listener = new SwitchUserListener($this->securityContext, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager);