minor #19736 [FrameworkBundle][Security] Remove useless mocks (Ener-Getick)
This PR was merged into the 2.7 branch.
Discussion
----------
[FrameworkBundle][Security] Remove useless mocks
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Removes mocks causing issues in https://github.com/symfony/symfony/pull/19734.
Commits
-------
fcd3345
[FrameworkBundle][Security] Remove useless mocks
This commit is contained in:
commit
6de4359e4b
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine;
|
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
|
class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -60,7 +61,7 @@ class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testRenderResponseWithFrameworkEngine()
|
public function testRenderResponseWithFrameworkEngine()
|
||||||
{
|
{
|
||||||
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
|
$response = new Response();
|
||||||
$engine = $this->getFrameworkEngineMock('template.php', true);
|
$engine = $this->getFrameworkEngineMock('template.php', true);
|
||||||
$engine->expects($this->once())
|
$engine->expects($this->once())
|
||||||
->method('renderResponse')
|
->method('renderResponse')
|
||||||
|
@ -13,6 +13,7 @@ namespace Symfony\Component\Security\Http\Tests\Authentication;
|
|||||||
|
|
||||||
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler;
|
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
|
|
||||||
class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCase
|
class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCase
|
||||||
@ -52,7 +53,7 @@ class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCas
|
|||||||
->method('createRequest')->with($this->request, '/login')
|
->method('createRequest')->with($this->request, '/login')
|
||||||
->will($this->returnValue($subRequest));
|
->will($this->returnValue($subRequest));
|
||||||
|
|
||||||
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
|
$response = new Response();
|
||||||
$this->httpKernel->expects($this->once())
|
$this->httpKernel->expects($this->once())
|
||||||
->method('handle')->with($subRequest, HttpKernelInterface::SUB_REQUEST)
|
->method('handle')->with($subRequest, HttpKernelInterface::SUB_REQUEST)
|
||||||
->will($this->returnValue($response));
|
->will($this->returnValue($response));
|
||||||
@ -65,7 +66,7 @@ class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCas
|
|||||||
|
|
||||||
public function testRedirect()
|
public function testRedirect()
|
||||||
{
|
{
|
||||||
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
|
$response = new Response();
|
||||||
$this->httpUtils->expects($this->once())
|
$this->httpUtils->expects($this->once())
|
||||||
->method('createRedirectResponse')->with($this->request, '/login')
|
->method('createRedirectResponse')->with($this->request, '/login')
|
||||||
->will($this->returnValue($response));
|
->will($this->returnValue($response));
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Http\Tests\Authentication;
|
namespace Symfony\Component\Security\Http\Tests\Authentication;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
|
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
|
||||||
|
|
||||||
class DefaultAuthenticationSuccessHandlerTest extends \PHPUnit_Framework_TestCase
|
class DefaultAuthenticationSuccessHandlerTest extends \PHPUnit_Framework_TestCase
|
||||||
@ -157,8 +158,7 @@ class DefaultAuthenticationSuccessHandlerTest extends \PHPUnit_Framework_TestCas
|
|||||||
|
|
||||||
private function expectRedirectResponse($path)
|
private function expectRedirectResponse($path)
|
||||||
{
|
{
|
||||||
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
|
$response = new Response();
|
||||||
|
|
||||||
$this->httpUtils->expects($this->once())
|
$this->httpUtils->expects($this->once())
|
||||||
->method('createRedirectResponse')
|
->method('createRedirectResponse')
|
||||||
->with($this->request, $path)
|
->with($this->request, $path)
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Http\Tests;
|
namespace Symfony\Component\Security\Http\Tests;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
|
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
|
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
|
// No methods are invoked on the exception; we just assert on its class
|
||||||
$this->authenticationException = new AuthenticationException();
|
$this->authenticationException = new AuthenticationException();
|
||||||
|
|
||||||
$this->response = $this->getMock('Symfony\Component\HttpFoundation\Response');
|
$this->response = new Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOnAuthenticationSuccessFallsBackToDefaultHandlerIfSimpleIsNotASuccessHandler()
|
public function testOnAuthenticationSuccessFallsBackToDefaultHandlerIfSimpleIsNotASuccessHandler()
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Http\Tests\EntryPoint;
|
namespace Symfony\Component\Security\Http\Tests\EntryPoint;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint;
|
use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ class FormAuthenticationEntryPointTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testStart()
|
public function testStart()
|
||||||
{
|
{
|
||||||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false);
|
$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');
|
$httpKernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
|
||||||
$httpUtils = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
|
$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);
|
$request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false);
|
||||||
$subRequest = $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 = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
|
||||||
$httpUtils
|
$httpUtils
|
||||||
|
@ -11,9 +11,10 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Http\Tests;
|
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\Event\GetResponseEvent;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
|
use Symfony\Component\Security\Http\Firewall;
|
||||||
|
|
||||||
class FirewallTest extends \PHPUnit_Framework_TestCase
|
class FirewallTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -46,7 +47,7 @@ class FirewallTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testOnKernelRequestStopsWhenThereIsAResponse()
|
public function testOnKernelRequestStopsWhenThereIsAResponse()
|
||||||
{
|
{
|
||||||
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
|
$response = new Response();
|
||||||
|
|
||||||
$first = $this->getMock('Symfony\Component\Security\Http\Firewall\ListenerInterface');
|
$first = $this->getMock('Symfony\Component\Security\Http\Firewall\ListenerInterface');
|
||||||
$first
|
$first
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Http\Tests\Logout;
|
namespace Symfony\Component\Security\Http\Tests\Logout;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler;
|
use Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler;
|
||||||
|
|
||||||
class DefaultLogoutSuccessHandlerTest extends \PHPUnit_Framework_TestCase
|
class DefaultLogoutSuccessHandlerTest extends \PHPUnit_Framework_TestCase
|
||||||
@ -18,7 +19,7 @@ class DefaultLogoutSuccessHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testLogout()
|
public function testLogout()
|
||||||
{
|
{
|
||||||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
$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 = $this->getMock('Symfony\Component\Security\Http\HttpUtils');
|
||||||
$httpUtils->expects($this->once())
|
$httpUtils->expects($this->once())
|
||||||
|
@ -15,6 +15,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|||||||
use Symfony\Component\Security\Http\RememberMe\ResponseListener;
|
use Symfony\Component\Security\Http\RememberMe\ResponseListener;
|
||||||
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Cookie;
|
use Symfony\Component\HttpFoundation\Cookie;
|
||||||
use Symfony\Component\HttpKernel\KernelEvents;
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ class ResponseListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
private function getResponse()
|
private function getResponse()
|
||||||
{
|
{
|
||||||
$response = $this->getMock('Symfony\Component\HttpFoundation\Response');
|
$response = new Response();
|
||||||
$response->headers = $this->getMock('Symfony\Component\HttpFoundation\ResponseHeaderBag');
|
$response->headers = $this->getMock('Symfony\Component\HttpFoundation\ResponseHeaderBag');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
Reference in New Issue
Block a user