diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2016-12-19 16:38:44 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2016-12-19 16:38:44 +0100 |
commit | b61218eac019add58b6eaf5bd0bdf331fb375ffb (patch) | |
tree | 81d5e0ad1bc52ea5cb4bcc570556e886c29fdc8c /Core/Tests/Authorization | |
parent | 8a7bf02f6038110dbf43a6c7dbf247acccac9817 (diff) | |
parent | 0582ad240b9aa4b86945b3fdee0f84b20eb0856f (diff) | |
download | symfony-security-b61218eac019add58b6eaf5bd0bdf331fb375ffb.zip symfony-security-b61218eac019add58b6eaf5bd0bdf331fb375ffb.tar.gz symfony-security-b61218eac019add58b6eaf5bd0bdf331fb375ffb.tar.bz2 |
Merge branch '2.7' into 2.8
* 2.7:
fixed obsolete getMock() usage
[WebProfilerBundle] Display multiple HTTP headers in WDT
Diffstat (limited to 'Core/Tests/Authorization')
6 files changed, 21 insertions, 21 deletions
diff --git a/Core/Tests/Authorization/AccessDecisionManagerTest.php b/Core/Tests/Authorization/AccessDecisionManagerTest.php index 412af91..94b9820 100644 --- a/Core/Tests/Authorization/AccessDecisionManagerTest.php +++ b/Core/Tests/Authorization/AccessDecisionManagerTest.php @@ -65,7 +65,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase */ public function testStrategies($strategy, $voters, $allowIfAllAbstainDecisions, $allowIfEqualGrantedDeniedDecisions, $expected) { - $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $manager = new AccessDecisionManager($voters, $strategy, $allowIfAllAbstainDecisions, $allowIfEqualGrantedDeniedDecisions); $this->assertSame($expected, $manager->decide($token, array('ROLE_FOO'))); @@ -83,7 +83,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase public function getStrategiesWith2RolesTests() { - $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); return array( array($token, 'affirmative', $this->getVoter(VoterInterface::ACCESS_DENIED), false), @@ -101,7 +101,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase protected function getVoterFor2Roles($token, $vote1, $vote2) { - $voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface'); + $voter = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface')->getMock(); $voter->expects($this->any()) ->method('vote') ->will($this->returnValueMap(array( @@ -166,7 +166,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase protected function getVoter($vote) { - $voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface'); + $voter = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface')->getMock(); $voter->expects($this->any()) ->method('vote') ->will($this->returnValue($vote)); @@ -176,7 +176,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase protected function getVoterSupportsClass($ret) { - $voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface'); + $voter = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface')->getMock(); $voter->expects($this->any()) ->method('supportsClass') ->will($this->returnValue($ret)); @@ -186,7 +186,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase protected function getVoterSupportsAttribute($ret) { - $voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface'); + $voter = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface')->getMock(); $voter->expects($this->any()) ->method('supportsAttribute') ->will($this->returnValue($ret)); diff --git a/Core/Tests/Authorization/AuthorizationCheckerTest.php b/Core/Tests/Authorization/AuthorizationCheckerTest.php index aafc12f..eed361c 100644 --- a/Core/Tests/Authorization/AuthorizationCheckerTest.php +++ b/Core/Tests/Authorization/AuthorizationCheckerTest.php @@ -23,8 +23,8 @@ class AuthorizationCheckerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->authenticationManager = $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface'); - $this->accessDecisionManager = $this->getMock('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface'); + $this->authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock(); + $this->accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock(); $this->tokenStorage = new TokenStorage(); $this->authorizationChecker = new AuthorizationChecker( @@ -36,10 +36,10 @@ class AuthorizationCheckerTest extends \PHPUnit_Framework_TestCase public function testVoteAuthenticatesTokenIfNecessary() { - $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $this->tokenStorage->setToken($token); - $newToken = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $newToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $this->authenticationManager ->expects($this->once()) @@ -78,7 +78,7 @@ class AuthorizationCheckerTest extends \PHPUnit_Framework_TestCase */ public function testIsGranted($decide) { - $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token ->expects($this->once()) ->method('isAuthenticated') diff --git a/Core/Tests/Authorization/Voter/AbstractVoterTest.php b/Core/Tests/Authorization/Voter/AbstractVoterTest.php index 69cfba3..558d4af 100644 --- a/Core/Tests/Authorization/Voter/AbstractVoterTest.php +++ b/Core/Tests/Authorization/Voter/AbstractVoterTest.php @@ -25,7 +25,7 @@ class AbstractVoterTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $this->token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); } /** diff --git a/Core/Tests/Authorization/Voter/AuthenticatedVoterTest.php b/Core/Tests/Authorization/Voter/AuthenticatedVoterTest.php index 4679c0f..a59848c 100644 --- a/Core/Tests/Authorization/Voter/AuthenticatedVoterTest.php +++ b/Core/Tests/Authorization/Voter/AuthenticatedVoterTest.php @@ -68,11 +68,11 @@ class AuthenticatedVoterTest extends \PHPUnit_Framework_TestCase protected function getToken($authenticated) { if ('fully' === $authenticated) { - return $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); } elseif ('remembered' === $authenticated) { - return $this->getMock('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken', array('setPersistent'), array(), '', false); + return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken')->setMethods(array('setPersistent'))->disableOriginalConstructor()->getMock(); } else { - return $this->getMock('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken', null, array('', '')); + return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken')->setConstructorArgs(array('', ''))->getMock(); } } } diff --git a/Core/Tests/Authorization/Voter/ExpressionVoterTest.php b/Core/Tests/Authorization/Voter/ExpressionVoterTest.php index dc8ea79..0770039 100644 --- a/Core/Tests/Authorization/Voter/ExpressionVoterTest.php +++ b/Core/Tests/Authorization/Voter/ExpressionVoterTest.php @@ -20,7 +20,7 @@ class ExpressionVoterTest extends \PHPUnit_Framework_TestCase public function testSupportsAttribute() { $expression = $this->createExpression(); - $expressionLanguage = $this->getMock('Symfony\Component\Security\Core\Authorization\ExpressionLanguage'); + $expressionLanguage = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\ExpressionLanguage')->getMock(); $voter = new ExpressionVoter($expressionLanguage, $this->createTrustResolver(), $this->createRoleHierarchy()); $this->assertTrue($voter->supportsAttribute($expression)); @@ -54,7 +54,7 @@ class ExpressionVoterTest extends \PHPUnit_Framework_TestCase foreach ($roles as $i => $role) { $roles[$i] = new Role($role); } - $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); if ($tokenExpectsGetRoles) { $token->expects($this->once()) @@ -67,7 +67,7 @@ class ExpressionVoterTest extends \PHPUnit_Framework_TestCase protected function createExpressionLanguage($expressionLanguageExpectsEvaluate = true) { - $mock = $this->getMock('Symfony\Component\Security\Core\Authorization\ExpressionLanguage'); + $mock = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\ExpressionLanguage')->getMock(); if ($expressionLanguageExpectsEvaluate) { $mock->expects($this->once()) @@ -80,12 +80,12 @@ class ExpressionVoterTest extends \PHPUnit_Framework_TestCase protected function createTrustResolver() { - return $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface'); + return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface')->getMock(); } protected function createRoleHierarchy() { - return $this->getMock('Symfony\Component\Security\Core\Role\RoleHierarchyInterface'); + return $this->getMockBuilder('Symfony\Component\Security\Core\Role\RoleHierarchyInterface')->getMock(); } protected function createExpression() diff --git a/Core/Tests/Authorization/Voter/RoleVoterTest.php b/Core/Tests/Authorization/Voter/RoleVoterTest.php index c15e936..ce4f4cf 100644 --- a/Core/Tests/Authorization/Voter/RoleVoterTest.php +++ b/Core/Tests/Authorization/Voter/RoleVoterTest.php @@ -57,7 +57,7 @@ class RoleVoterTest extends \PHPUnit_Framework_TestCase foreach ($roles as $i => $role) { $roles[$i] = new Role($role); } - $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token->expects($this->once()) ->method('getRoles') ->will($this->returnValue($roles)); |