[Security] [HttpFoundation] Use class const in test

This commit is contained in:
Oskar Stark 2021-01-22 08:08:23 +01:00
parent 1c9d2c8982
commit 4a98eeecdc
2 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
@ -165,7 +166,7 @@ class FormLoginAuthenticatorTest extends TestCase
private function createSession() private function createSession()
{ {
return $this->createMock('Symfony\Component\HttpFoundation\Session\SessionInterface'); return $this->createMock(SessionInterface::class);
} }
} }

View File

@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\Security\Http\Event\LogoutEvent; use Symfony\Component\Security\Http\Event\LogoutEvent;
use Symfony\Component\Security\Http\Firewall\LogoutListener; use Symfony\Component\Security\Http\Firewall\LogoutListener;
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface; use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
class LogoutListenerTest extends TestCase class LogoutListenerTest extends TestCase
@ -183,7 +184,7 @@ class LogoutListenerTest extends TestCase
$response = new Response(); $response = new Response();
$logoutSuccessHandler->expects($this->any())->method('onLogoutSuccess')->willReturn($response); $logoutSuccessHandler->expects($this->any())->method('onLogoutSuccess')->willReturn($response);
$handler = $this->createMock('Symfony\Component\Security\Http\Logout\LogoutHandlerInterface'); $handler = $this->createMock(LogoutHandlerInterface::class);
$handler->expects($this->once())->method('logout')->with($request, $response, $token); $handler->expects($this->once())->method('logout')->with($request, $response, $token);
$listener->addHandler($handler); $listener->addHandler($handler);