summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2014-02-11 08:51:18 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2014-02-11 11:29:24 +0100
commitfc8250e983069954aa8b74703664cf5dc988d863 (patch)
treeb5957d2b87831d6660486acc03b4eb44ea15593e
parent586de0cf323da4453f94058efad5736f899eaec8 (diff)
downloadsymfony-security-fc8250e983069954aa8b74703664cf5dc988d863.zip
symfony-security-fc8250e983069954aa8b74703664cf5dc988d863.tar.gz
symfony-security-fc8250e983069954aa8b74703664cf5dc988d863.tar.bz2
fixed various inconsistenciesv2.3.10
-rw-r--r--Tests/Acl/Permission/MaskBuilderTest.php2
-rw-r--r--Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php18
-rw-r--r--Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php6
-rw-r--r--Tests/Core/Util/SecureRandomTest.php4
-rw-r--r--Tests/Http/RememberMe/AbstractRememberMeServicesTest.php22
-rw-r--r--Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php24
-rw-r--r--Tests/Http/RememberMe/ResponseListenerTest.php2
-rw-r--r--Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php18
8 files changed, 48 insertions, 48 deletions
diff --git a/Tests/Acl/Permission/MaskBuilderTest.php b/Tests/Acl/Permission/MaskBuilderTest.php
index dc86755..de034e3 100644
--- a/Tests/Acl/Permission/MaskBuilderTest.php
+++ b/Tests/Acl/Permission/MaskBuilderTest.php
@@ -76,7 +76,7 @@ class MaskBuilderTest extends \PHPUnit_Framework_TestCase
public function testGetPattern()
{
- $builder = new MaskBuilder;
+ $builder = new MaskBuilder();
$this->assertEquals(MaskBuilder::ALL_OFF, $builder->getPattern());
$builder->add('view');
diff --git a/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php b/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php
index 8b27061..d5d6067 100644
--- a/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php
+++ b/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php
@@ -115,7 +115,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
->method('isPasswordValid')
;
- $provider = $this->getProvider(false, false, $encoder);
+ $provider = $this->getProvider(null, null, $encoder);
$method = new \ReflectionMethod($provider, 'checkAuthentication');
$method->setAccessible(true);
@@ -142,7 +142,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue(true))
;
- $provider = $this->getProvider(false, false, $encoder);
+ $provider = $this->getProvider(null, null, $encoder);
$method = new \ReflectionMethod($provider, 'checkAuthentication');
$method->setAccessible(true);
@@ -171,7 +171,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue(false))
;
- $provider = $this->getProvider(false, false, $encoder);
+ $provider = $this->getProvider(null, null, $encoder);
$method = new \ReflectionMethod($provider, 'checkAuthentication');
$method->setAccessible(true);
@@ -206,7 +206,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue('newFoo'))
;
- $provider = $this->getProvider(false, false, null);
+ $provider = $this->getProvider();
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
$reflection->setAccessible(true);
$reflection->invoke($provider, $dbUser, $token);
@@ -231,7 +231,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue('foo'))
;
- $provider = $this->getProvider(false, false, null);
+ $provider = $this->getProvider();
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
$reflection->setAccessible(true);
$reflection->invoke($provider, $dbUser, $token);
@@ -245,7 +245,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue(true))
;
- $provider = $this->getProvider(false, false, $encoder);
+ $provider = $this->getProvider(null, null, $encoder);
$method = new \ReflectionMethod($provider, 'checkAuthentication');
$method->setAccessible(true);
@@ -270,17 +270,17 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
return $mock;
}
- protected function getProvider($user = false, $userChecker = false, $passwordEncoder = null)
+ protected function getProvider($user = null, $userChecker = null, $passwordEncoder = null)
{
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
- if (false !== $user) {
+ if (null !== $user) {
$userProvider->expects($this->once())
->method('loadUserByUsername')
->will($this->returnValue($user))
;
}
- if (false === $userChecker) {
+ if (null === $userChecker) {
$userChecker = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface');
}
diff --git a/Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php b/Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
index f7ffb1e..8ad4549 100644
--- a/Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
+++ b/Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
@@ -114,17 +114,17 @@ class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_Test
return $token;
}
- protected function getProvider($user = false, $userChecker = false)
+ protected function getProvider($user = null, $userChecker = null)
{
$userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
- if (false !== $user) {
+ if (null !== $user) {
$userProvider->expects($this->once())
->method('loadUserByUsername')
->will($this->returnValue($user))
;
}
- if (false === $userChecker) {
+ if (null === $userChecker) {
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
}
diff --git a/Tests/Core/Util/SecureRandomTest.php b/Tests/Core/Util/SecureRandomTest.php
index 38e9121..05b4b02 100644
--- a/Tests/Core/Util/SecureRandomTest.php
+++ b/Tests/Core/Util/SecureRandomTest.php
@@ -111,8 +111,8 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
{
$b = $this->getBitSequence($secureRandom, 20000);
- $longestRun = 0;
- $currentRun = $lastBit = null;
+ $longestRun = $currentRun = 0;
+ $lastBit = null;
for ($i = 0; $i < 20000; $i++) {
if ($lastBit === $b[$i]) {
$currentRun += 1;
diff --git a/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php b/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php
index 8571686..02ca8d2 100644
--- a/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php
+++ b/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php
@@ -50,7 +50,7 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserInterface()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', 'foo');
$service
@@ -113,8 +113,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
public function testLoginSuccessIsNotProcessedWhenTokenDoesNotContainUserInterfaceImplementation()
{
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
- $request = new Request;
- $response = new Response;
+ $request = new Request();
+ $response = new Response();
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$token
@@ -136,8 +136,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
public function testLoginSuccessIsNotProcessedWhenRememberMeIsNotRequested()
{
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo', 'path' => null, 'domain' => null));
- $request = new Request;
- $response = new Response;
+ $request = new Request();
+ $response = new Response();
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$token
@@ -160,8 +160,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
public function testLoginSuccessWhenRememberMeAlwaysIsTrue()
{
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
- $request = new Request;
- $response = new Response;
+ $request = new Request();
+ $response = new Response();
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$token
@@ -186,9 +186,9 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
{
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo[bar]', 'path' => null, 'domain' => null));
- $request = new Request;
+ $request = new Request();
$request->request->set('foo', array('bar' => $value));
- $response = new Response;
+ $response = new Response();
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$token
@@ -213,9 +213,9 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
{
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo', 'path' => null, 'domain' => null));
- $request = new Request;
+ $request = new Request();
$request->request->set('foo', $value);
- $response = new Response;
+ $response = new Response();
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$token
diff --git a/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
index 7fc3021..26a878f 100644
--- a/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
+++ b/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
@@ -43,7 +43,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
public function testAutoLoginThrowsExceptionOnInvalidCookie()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
- $request = new Request;
+ $request = new Request();
$request->request->set('foo', 'true');
$request->cookies->set('foo', 'foo');
@@ -54,7 +54,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
public function testAutoLoginThrowsExceptionOnNonExistentToken()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
- $request = new Request;
+ $request = new Request();
$request->request->set('foo', 'true');
$request->cookies->set('foo', $this->encodeCookie(array(
$series = 'fooseries',
@@ -77,7 +77,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
{
$userProvider = $this->getProvider();
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600, 'secure' => false, 'httponly' => false));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
@@ -102,7 +102,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
{
$userProvider = $this->getProvider();
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
@@ -132,7 +132,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
public function testAutoLoginDoesNotAcceptAnExpiredCookie()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
@@ -166,7 +166,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
;
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'secure' => false, 'httponly' => false, 'always_remember_me' => true, 'lifetime' => 3600));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
@@ -214,8 +214,8 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
public function testLogoutSimplyIgnoresNonSetRequestCookie()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
- $request = new Request;
- $response = new Response;
+ $request = new Request();
+ $response = new Response();
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
@@ -236,9 +236,9 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
public function testLogoutSimplyIgnoresInvalidCookie()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', 'somefoovalue');
- $response = new Response;
+ $response = new Response();
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
@@ -266,8 +266,8 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
public function testLoginSuccessSetsCookieWhenLoggedInWithNonRememberMeTokenInterfaceImplementation()
{
$service = $this->getService(null, array('name' => 'foo', 'domain' => 'myfoodomain.foo', 'path' => '/foo/path', 'secure' => true, 'httponly' => true, 'lifetime' => 3600, 'always_remember_me' => true));
- $request = new Request;
- $response = new Response;
+ $request = new Request();
+ $response = new Response();
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$account
diff --git a/Tests/Http/RememberMe/ResponseListenerTest.php b/Tests/Http/RememberMe/ResponseListenerTest.php
index cbd3f1f..8b4667d 100644
--- a/Tests/Http/RememberMe/ResponseListenerTest.php
+++ b/Tests/Http/RememberMe/ResponseListenerTest.php
@@ -56,7 +56,7 @@ class ResponseListenerTest extends \PHPUnit_Framework_TestCase
{
$listener = new ResponseListener();
- $this->assertSame(array(KernelEvents::RESPONSE => 'onKernelResponse'), $listener->getSubscribedEvents());
+ $this->assertSame(array(KernelEvents::RESPONSE => 'onKernelResponse'), ResponseListener::getSubscribedEvents());
}
private function getRequest(array $attributes = array())
diff --git a/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php b/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php
index 4699257..3ff2ea6 100644
--- a/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php
+++ b/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php
@@ -39,7 +39,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
public function testAutoLoginThrowsExceptionOnInvalidCookie()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
- $request = new Request;
+ $request = new Request();
$request->request->set('foo', 'true');
$request->cookies->set('foo', 'foo');
@@ -51,7 +51,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
{
$userProvider = $this->getProvider();
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
$userProvider
@@ -68,7 +68,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
{
$userProvider = $this->getProvider();
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', base64_encode('class:'.base64_encode('foouser').':123456789:fooHash'));
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
@@ -93,7 +93,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
{
$userProvider = $this->getProvider();
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() - 1, 'foopass'));
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
@@ -137,7 +137,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
;
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
- $request = new Request;
+ $request = new Request();
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
$returnedToken = $service->autoLogin($request);
@@ -179,8 +179,8 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
public function testLoginSuccessIgnoresTokensWhichDoNotContainAnUserInterfaceImplementation()
{
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
- $request = new Request;
- $response = new Response;
+ $request = new Request();
+ $response = new Response();
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$token
->expects($this->once())
@@ -200,8 +200,8 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
public function testLoginSuccess()
{
$service = $this->getService(null, array('name' => 'foo', 'domain' => 'myfoodomain.foo', 'path' => '/foo/path', 'secure' => true, 'httponly' => true, 'lifetime' => 3600, 'always_remember_me' => true));
- $request = new Request;
- $response = new Response;
+ $request = new Request();
+ $response = new Response();
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');