Skip to content

Commit dbee498

Browse files
Merge branch '3.1'
* 3.1: fix typo add "provides" for psr/cache-implementation [Validator][GroupSequence] fixed GroupSequence validation ignores PropertyMetadata of parent classes [FrameworkBundle][Security] Remove useless mocks Add symfony/inflector to composer.json "replaces" [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
2 parents e8f4626 + 20737ce commit dbee498

8 files changed

+18
-12
lines changed

Firewall/BasicAuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function handle(GetResponseEvent $event)
5656
{
5757
$request = $event->getRequest();
5858

59-
if (false === $username = $request->headers->get('PHP_AUTH_USER', false)) {
59+
if (null === $username = $request->headers->get('PHP_AUTH_USER')) {
6060
return;
6161
}
6262

Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler;
1515
use Symfony\Component\Security\Core\Security;
16+
use Symfony\Component\HttpFoundation\Response;
1617
use Symfony\Component\HttpKernel\HttpKernelInterface;
1718

1819
class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCase
@@ -47,7 +48,7 @@ public function testForward()
4748
->method('createRequest')->with($this->request, '/login')
4849
->will($this->returnValue($subRequest));
4950

50-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
51+
$response = new Response();
5152
$this->httpKernel->expects($this->once())
5253
->method('handle')->with($subRequest, HttpKernelInterface::SUB_REQUEST)
5354
->will($this->returnValue($response));
@@ -60,7 +61,7 @@ public function testForward()
6061

6162
public function testRedirect()
6263
{
63-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
64+
$response = new Response();
6465
$this->httpUtils->expects($this->once())
6566
->method('createRedirectResponse')->with($this->request, '/login')
6667
->will($this->returnValue($response));

Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Http\Tests\Authentication;
1313

14+
use Symfony\Component\HttpFoundation\Response;
1415
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
1516

1617
class DefaultAuthenticationSuccessHandlerTest extends \PHPUnit_Framework_TestCase
@@ -171,8 +172,7 @@ public function testRefererTargetPathIsIgnoredByDefault()
171172

172173
private function expectRedirectResponse($path)
173174
{
174-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
175-
175+
$response = new Response();
176176
$this->httpUtils->expects($this->once())
177177
->method('createRedirectResponse')
178178
->with($this->request, $path)

Tests/Authentication/SimpleAuthenticationHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Http\Tests;
1313

14+
use Symfony\Component\HttpFoundation\Response;
1415
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
1516
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1617
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
@@ -41,7 +42,7 @@ protected function setUp()
4142
// No methods are invoked on the exception; we just assert on its class
4243
$this->authenticationException = new AuthenticationException();
4344

44-
$this->response = $this->getMock('Symfony\Component\HttpFoundation\Response');
45+
$this->response = new Response();
4546
}
4647

4748
public function testOnAuthenticationSuccessFallsBackToDefaultHandlerIfSimpleIsNotASuccessHandler()

Tests/EntryPoint/FormAuthenticationEntryPointTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Http\Tests\EntryPoint;
1313

14+
use Symfony\Component\HttpFoundation\Response;
1415
use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint;
1516
use Symfony\Component\HttpKernel\HttpKernelInterface;
1617

@@ -19,7 +20,7 @@ class FormAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
1920
public function testStart()
2021
{
2122
$request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false);
22-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
23+
$response = new Response();
2324

2425
$httpKernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
2526
$httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
@@ -39,7 +40,7 @@ public function testStartWithUseForward()
3940
{
4041
$request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false);
4142
$subRequest = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false);
42-
$response = new \Symfony\Component\HttpFoundation\Response('', 200);
43+
$response = new Response('', 200);
4344

4445
$httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
4546
$httpUtils

Tests/FirewallTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
namespace Symfony\Component\Security\Http\Tests;
1313

14-
use Symfony\Component\Security\Http\Firewall;
14+
use Symfony\Component\HttpFoundation\Response;
1515
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1616
use Symfony\Component\HttpKernel\HttpKernelInterface;
17+
use Symfony\Component\Security\Http\Firewall;
1718

1819
class FirewallTest extends \PHPUnit_Framework_TestCase
1920
{
@@ -46,7 +47,7 @@ public function testOnKernelRequestRegistersExceptionListener()
4647

4748
public function testOnKernelRequestStopsWhenThereIsAResponse()
4849
{
49-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
50+
$response = new Response();
5051

5152
$first = $this->getMock('Symfony\Component\Security\Http\Firewall\ListenerInterface');
5253
$first

Tests/Logout/DefaultLogoutSuccessHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
namespace Symfony\Component\Security\Http\Tests\Logout;
1313

14+
use Symfony\Component\HttpFoundation\Response;
1415
use Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler;
1516

1617
class DefaultLogoutSuccessHandlerTest extends \PHPUnit_Framework_TestCase
1718
{
1819
public function testLogout()
1920
{
2021
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
21-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
22+
$response = new Response();
2223

2324
$httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
2425
$httpUtils->expects($this->once())

Tests/RememberMe/ResponseListenerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Security\Http\RememberMe\ResponseListener;
1616
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
1717
use Symfony\Component\HttpFoundation\Request;
18+
use Symfony\Component\HttpFoundation\Response;
1819
use Symfony\Component\HttpFoundation\Cookie;
1920
use Symfony\Component\HttpKernel\KernelEvents;
2021

@@ -81,7 +82,7 @@ private function getRequest(array $attributes = array())
8182

8283
private function getResponse()
8384
{
84-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
85+
$response = new Response();
8586
$response->headers = $this->getMock('Symfony\Component\HttpFoundation\ResponseHeaderBag');
8687

8788
return $response;

0 commit comments

Comments
 (0)