Merge branch '4.4' into 5.1

* 4.4:
  Use class const in test
This commit is contained in:
Jérémy Derussé 2021-01-22 11:23:37 +01:00
commit ac362e369c
No known key found for this signature in database
GPG Key ID: 2083FA5758C473D2
3 changed files with 14 additions and 13 deletions

View File

@ -20,6 +20,7 @@ use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpKernel\KernelInterface;
class WebProfilerExtensionTest extends TestCase
{
@ -51,7 +52,7 @@ class WebProfilerExtensionTest extends TestCase
{
parent::setUp();
$this->kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
$this->kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
$this->container = new ContainerBuilder();
$this->container->register('error_handler.error_renderer.html', HtmlErrorRenderer::class)->setPublic(true);

View File

@ -20,8 +20,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tests\Fixtures\DummyOutput;
/**
* Console logger test.
*
* @author Kévin Dunglas <dunglas@gmail.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
@ -157,9 +155,9 @@ class ConsoleLoggerTest extends TestCase
public function testObjectCastToString()
{
if (method_exists($this, 'createPartialMock')) {
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
} else {
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
}
$dummy->method('__toString')->willReturn('DUMMY');

View File

@ -18,9 +18,11 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Security\Http\AccessMapInterface;
use Symfony\Component\Security\Http\Event\LazyResponseEvent;
@ -30,7 +32,7 @@ class AccessListenerTest extends TestCase
{
public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
{
$this->expectException(\Symfony\Component\Security\Core\Exception\AccessDeniedException::class);
$this->expectException(AccessDeniedException::class);
$request = new Request();
$accessMap = $this->getMockBuilder(AccessMapInterface::class)->getMock();
@ -41,7 +43,7 @@ class AccessListenerTest extends TestCase
->willReturn([['foo' => 'bar'], null])
;
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
$token
->expects($this->any())
->method('isAuthenticated')
@ -85,14 +87,14 @@ class AccessListenerTest extends TestCase
->willReturn([['foo' => 'bar'], null])
;
$notAuthenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$notAuthenticatedToken = $this->getMockBuilder(TokenInterface::class)->getMock();
$notAuthenticatedToken
->expects($this->any())
->method('isAuthenticated')
->willReturn(false)
;
$authenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$authenticatedToken = $this->getMockBuilder(TokenInterface::class)->getMock();
$authenticatedToken
->expects($this->any())
->method('isAuthenticated')
@ -149,7 +151,7 @@ class AccessListenerTest extends TestCase
->willReturn([null, null])
;
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
$token
->expects($this->never())
->method('isAuthenticated')
@ -204,7 +206,7 @@ class AccessListenerTest extends TestCase
public function testHandleWhenTheSecurityTokenStorageHasNoToken()
{
$this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException::class);
$this->expectException(AuthenticationCredentialsNotFoundException::class);
$tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
$tokenStorage
->expects($this->any())
@ -320,7 +322,7 @@ class AccessListenerTest extends TestCase
->willReturn([['foo' => 'bar', 'bar' => 'baz'], null])
;
$authenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
$authenticatedToken = $this->getMockBuilder(TokenInterface::class)->getMock();
$authenticatedToken
->expects($this->any())
->method('isAuthenticated')
@ -342,7 +344,7 @@ class AccessListenerTest extends TestCase
$tokenStorage,
$accessDecisionManager,
$accessMap,
$this->createMock('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')
$this->createMock(AuthenticationManagerInterface::class)
);
$listener(new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MASTER_REQUEST));