Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
@@ -22,12 +22,7 @@ class FirewallContextTest extends TestCase
public function testGetters()
{
$config = new FirewallConfig('main', 'user_checker', 'request_matcher');
$exceptionListener = $this
->getMockBuilder(ExceptionListener::class)
->disableOriginalConstructor()
->getMock();
$exceptionListener = $this->getExceptionListenerMock();
$listeners = array(
$this
->getMockBuilder(ListenerInterface::class)
@@ -37,7 +32,28 @@ class FirewallContextTest extends TestCase
$context = new FirewallContext($listeners, $exceptionListener, $config);
$this->assertEquals(array($listeners, $exceptionListener), $context->getContext());
$this->assertEquals($listeners, $context->getListeners());
$this->assertEquals($exceptionListener, $context->getExceptionListener());
$this->assertEquals($config, $context->getConfig());
}
/**
* @expectedDeprecation Method Symfony\Bundle\SecurityBundle\Security\FirewallContext::getContext() is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Bundle\SecurityBundle\Security\FirewallContext::getListeners/getExceptionListener() instead.
* @group legacy
*/
public function testGetContext()
{
$context = (new FirewallContext($listeners = array(), $exceptionListener = $this->getExceptionListenerMock(), new FirewallConfig('main', 'request_matcher', 'user_checker')))
->getContext();
$this->assertEquals(array($listeners, $exceptionListener), $context);
}
private function getExceptionListenerMock()
{
return $this
->getMockBuilder(ExceptionListener::class)
->disableOriginalConstructor()
->getMock();
}
}
@@ -12,11 +12,15 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Security;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\SecurityBundle\Security\FirewallConfig;
use Symfony\Bundle\SecurityBundle\Security\FirewallContext;
use Symfony\Bundle\SecurityBundle\Security\FirewallMap;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
class FirewallMapTest extends TestCase
{
@@ -58,8 +62,15 @@ class FirewallMapTest extends TestCase
$request = new Request();
$firewallContext = $this->getMockBuilder(FirewallContext::class)->disableOriginalConstructor()->getMock();
$firewallContext->expects($this->once())->method('getConfig')->willReturn('CONFIG');
$firewallContext->expects($this->once())->method('getContext')->willReturn(array('LISTENERS', 'EXCEPTION LISTENER'));
$firewallConfig = new FirewallConfig('main', $this->getMockBuilder(UserCheckerInterface::class)->getMock());
$firewallContext->expects($this->once())->method('getConfig')->willReturn($firewallConfig);
$listener = $this->getMockBuilder(ListenerInterface::class)->getMock();
$firewallContext->expects($this->once())->method('getListeners')->willReturn(array($listener));
$exceptionListener = $this->getMockBuilder(ExceptionListener::class)->disableOriginalConstructor()->getMock();
$firewallContext->expects($this->once())->method('getExceptionListener')->willReturn($exceptionListener);
$matcher = $this->getMockBuilder(RequestMatcherInterface::class)->getMock();
$matcher->expects($this->once())
@@ -72,8 +83,8 @@ class FirewallMapTest extends TestCase
$firewallMap = new FirewallMap($container, array('security.firewall.map.context.foo' => $matcher));
$this->assertEquals(array('LISTENERS', 'EXCEPTION LISTENER'), $firewallMap->getListeners($request));
$this->assertEquals('CONFIG', $firewallMap->getFirewallConfig($request));
$this->assertEquals(array(array($listener), $exceptionListener), $firewallMap->getListeners($request));
$this->assertEquals($firewallConfig, $firewallMap->getFirewallConfig($request));
$this->assertEquals('security.firewall.map.context.foo', $request->attributes->get(self::ATTRIBUTE_FIREWALL_CONTEXT));
}
}