diff options
author | Christian Flothmann <christian.flothmann@xabbuh.de> | 2016-03-25 09:55:34 +0100 |
---|---|---|
committer | Christian Flothmann <christian.flothmann@xabbuh.de> | 2016-03-25 10:45:26 +0100 |
commit | f9e167fde187546f3eb91f62d8de5ba36483a70a (patch) | |
tree | 76b8fe393817611c27a319770cfe9a6544aee7e5 | |
parent | 7dbb63e02629f9223fb012ba34f6bf94a3a12c3f (diff) | |
download | symfony-security-f9e167fde187546f3eb91f62d8de5ba36483a70a.zip symfony-security-f9e167fde187546f3eb91f62d8de5ba36483a70a.tar.gz symfony-security-f9e167fde187546f3eb91f62d8de5ba36483a70a.tar.bz2 |
fix mocks
* fix a typo in a method name (`setResponse` instead of `seetResopnse`)
* fix mocking a method that is not part of the `DomainObjectInterface`
-rw-r--r-- | Tests/Acl/Domain/ObjectIdentityTest.php | 26 | ||||
-rw-r--r-- | Tests/Http/Firewall/SwitchUserListenerTest.php | 2 |
2 files changed, 16 insertions, 12 deletions
diff --git a/Tests/Acl/Domain/ObjectIdentityTest.php b/Tests/Acl/Domain/ObjectIdentityTest.php index 111ae8a..312f433 100644 --- a/Tests/Acl/Domain/ObjectIdentityTest.php +++ b/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/Tests/Http/Firewall/SwitchUserListenerTest.php b/Tests/Http/Firewall/SwitchUserListenerTest.php index 7ba71d4..1852751 100644 --- a/Tests/Http/Firewall/SwitchUserListenerTest.php +++ b/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); |