Skip to content

Commit 32d09b6

Browse files
committed
[FrameworkBundle][Security] Remove useless mocks
1 parent f876473 commit 32d09b6

File tree

8 files changed

+19
-12
lines changed

8 files changed

+19
-12
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
1313

1414
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine;
15+
use Symfony\Component\HttpFoundation\Response;
1516

1617
class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
1718
{
@@ -60,7 +61,7 @@ public function testGetInvalidEngine()
6061

6162
public function testRenderResponseWithFrameworkEngine()
6263
{
63-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
64+
$response = new Response();
6465
$engine = $this->getFrameworkEngineMock('template.php', true);
6566
$engine->expects($this->once())
6667
->method('renderResponse')

src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php

+3-2
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
@@ -52,7 +53,7 @@ public function testForward()
5253
->method('createRequest')->with($this->request, '/login')
5354
->will($this->returnValue($subRequest));
5455

55-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
56+
$response = new Response();
5657
$this->httpKernel->expects($this->once())
5758
->method('handle')->with($subRequest, HttpKernelInterface::SUB_REQUEST)
5859
->will($this->returnValue($response));
@@ -65,7 +66,7 @@ public function testForward()
6566

6667
public function testRedirect()
6768
{
68-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
69+
$response = new Response();
6970
$this->httpUtils->expects($this->once())
7071
->method('createRedirectResponse')->with($this->request, '/login')
7172
->will($this->returnValue($response));

src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php

+2-2
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
@@ -157,8 +158,7 @@ public function testRefererTargetPathIsIgnoredByDefault()
157158

158159
private function expectRedirectResponse($path)
159160
{
160-
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
161-
161+
$response = new Response();
162162
$this->httpUtils->expects($this->once())
163163
->method('createRedirectResponse')
164164
->with($this->request, $path)

src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php

+2-1
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()

src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php

+3-2
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

src/Symfony/Component/Security/Http/Tests/FirewallTest.php

+3-2
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

src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php

+2-1
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())

src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php

+2-1
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)