summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Grekas <nicolas.grekas@gmail.com>2016-08-26 13:44:05 +0200
committerNicolas Grekas <nicolas.grekas@gmail.com>2016-08-26 13:57:43 +0200
commitcc1acd8d76c84b8bddbf0ad884954ba0523e5c7d (patch)
tree095ed6910d794102ac873258183b3244013fa4b2
parentd46dc33fbe1f845398e90e36410965e8de71075c (diff)
parent66a4782ddd0539e1b4f2ae2b4058a04af5d21aab (diff)
downloadsymfony-security-cc1acd8d76c84b8bddbf0ad884954ba0523e5c7d.zip
symfony-security-cc1acd8d76c84b8bddbf0ad884954ba0523e5c7d.tar.gz
symfony-security-cc1acd8d76c84b8bddbf0ad884954ba0523e5c7d.tar.bz2
Merge branch '2.7' into 2.8v2.8.10
* 2.7: [Validator][GroupSequence] fixed GroupSequence validation ignores PropertyMetadata of parent classes [FrameworkBundle][Security] Remove useless mocks [DoctrineBridge] Enhance exception message in EntityUserProvider added friendly exception when constraint validator does not exist or it is not enabled remove duplicate instruction [FrameworkBundle] Remove TranslatorBagInterface check [FrameworkBundle] Remove duplicated code in RouterDebugCommand [Validator] fixed duplicate constraints with parent class interfaces SecurityBundle:BasicAuthenticationListener: removed a default argument on getting a header value
-rw-r--r--Http/Firewall/BasicAuthenticationListener.php2
-rw-r--r--Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php5
-rw-r--r--Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php4
-rw-r--r--Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php3
-rw-r--r--Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php5
-rw-r--r--Http/Tests/FirewallTest.php5
-rw-r--r--Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php3
-rw-r--r--Http/Tests/RememberMe/ResponseListenerTest.php3
8 files changed, 18 insertions, 12 deletions
diff --git a/Http/Firewall/BasicAuthenticationListener.php b/Http/Firewall/BasicAuthenticationListener.php
index ebe96ea..5bbf13d 100644
--- a/Http/Firewall/BasicAuthenticationListener.php
+++ b/Http/Firewall/BasicAuthenticationListener.php
@@ -56,7 +56,7 @@ class BasicAuthenticationListener implements ListenerInterface
{
$request = $event->getRequest();
- if (false === $username = $request->headers->get('PHP_AUTH_USER', false)) {
+ if (null === $username = $request->headers->get('PHP_AUTH_USER')) {
return;
}
diff --git a/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
index 8f854c8..c97ee69 100644
--- a/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
+++ b/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
@@ -13,6 +13,7 @@ namespace Symfony\Component\Security\Http\Tests\Authentication;
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler;
use Symfony\Component\Security\Core\Security;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCase
@@ -47,7 +48,7 @@ class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCas
->method('createRequest')->with($this->request, '/login')
->will($this->returnValue($subRequest));
- $response = $this->getMock('Symfony\Component\HttpFoundation\Response');
+ $response = new Response();
$this->httpKernel->expects($this->once())
->method('handle')->with($subRequest, HttpKernelInterface::SUB_REQUEST)
->will($this->returnValue($response));
@@ -60,7 +61,7 @@ class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCas
public function testRedirect()
{
- $response = $this->getMock('Symfony\Component\HttpFoundation\Response');
+ $response = new Response();
$this->httpUtils->expects($this->once())
->method('createRedirectResponse')->with($this->request, '/login')
->will($this->returnValue($response));
diff --git a/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php b/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
index 2c22da6..5372993 100644
--- a/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
+++ b/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Security\Http\Tests\Authentication;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
class DefaultAuthenticationSuccessHandlerTest extends \PHPUnit_Framework_TestCase
@@ -171,8 +172,7 @@ class DefaultAuthenticationSuccessHandlerTest extends \PHPUnit_Framework_TestCas
private function expectRedirectResponse($path)
{
- $response = $this->getMock('Symfony\Component\HttpFoundation\Response');
-
+ $response = new Response();
$this->httpUtils->expects($this->once())
->method('createRedirectResponse')
->with($this->request, $path)
diff --git a/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php b/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
index 6e79b07..8a31886 100644
--- a/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
+++ b/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Security\Http\Tests;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
@@ -41,7 +42,7 @@ class SimpleAuthenticationHandlerTest extends \PHPUnit_Framework_TestCase
// No methods are invoked on the exception; we just assert on its class
$this->authenticationException = new AuthenticationException();
- $this->response = $this->getMock('Symfony\Component\HttpFoundation\Response');
+ $this->response = new Response();
}
public function testOnAuthenticationSuccessFallsBackToDefaultHandlerIfSimpleIsNotASuccessHandler()
diff --git a/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php b/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php
index 3acb9c2..75a6be4 100644
--- a/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php
+++ b/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Security\Http\Tests\EntryPoint;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint;
use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -19,7 +20,7 @@ class FormAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
public function testStart()
{
$request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false);
- $response = $this->getMock('Symfony\Component\HttpFoundation\Response');
+ $response = new Response();
$httpKernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
$httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
@@ -39,7 +40,7 @@ class FormAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
{
$request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false);
$subRequest = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false);
- $response = new \Symfony\Component\HttpFoundation\Response('', 200);
+ $response = new Response('', 200);
$httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
$httpUtils
diff --git a/Http/Tests/FirewallTest.php b/Http/Tests/FirewallTest.php
index 9994737..1e0c1ef 100644
--- a/Http/Tests/FirewallTest.php
+++ b/Http/Tests/FirewallTest.php
@@ -11,9 +11,10 @@
namespace Symfony\Component\Security\Http\Tests;
-use Symfony\Component\Security\Http\Firewall;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
+use Symfony\Component\Security\Http\Firewall;
class FirewallTest extends \PHPUnit_Framework_TestCase
{
@@ -46,7 +47,7 @@ class FirewallTest extends \PHPUnit_Framework_TestCase
public function testOnKernelRequestStopsWhenThereIsAResponse()
{
- $response = $this->getMock('Symfony\Component\HttpFoundation\Response');
+ $response = new Response();
$first = $this->getMock('Symfony\Component\Security\Http\Firewall\ListenerInterface');
$first
diff --git a/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php b/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php
index 381a48e..8a94e53 100644
--- a/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php
+++ b/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Security\Http\Tests\Logout;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler;
class DefaultLogoutSuccessHandlerTest extends \PHPUnit_Framework_TestCase
@@ -18,7 +19,7 @@ class DefaultLogoutSuccessHandlerTest extends \PHPUnit_Framework_TestCase
public function testLogout()
{
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
- $response = $this->getMock('Symfony\Component\HttpFoundation\Response');
+ $response = new Response();
$httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
$httpUtils->expects($this->once())
diff --git a/Http/Tests/RememberMe/ResponseListenerTest.php b/Http/Tests/RememberMe/ResponseListenerTest.php
index 78de8e4..23f7df7 100644
--- a/Http/Tests/RememberMe/ResponseListenerTest.php
+++ b/Http/Tests/RememberMe/ResponseListenerTest.php
@@ -15,6 +15,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Http\RememberMe\ResponseListener;
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpKernel\KernelEvents;
@@ -81,7 +82,7 @@ class ResponseListenerTest extends \PHPUnit_Framework_TestCase
private function getResponse()
{
- $response = $this->getMock('Symfony\Component\HttpFoundation\Response');
+ $response = new Response();
$response->headers = $this->getMock('Symfony\Component\HttpFoundation\ResponseHeaderBag');
return $response;