N°3129 PHP 8.0 compat: Fix "Deprecated: Required parameter ... follows optional parameter ..." in Twig

Update symfony/twig-bundle from 3.4.36 to 3.4.47
This commit is contained in:
Pierre Goiffon
2022-01-28 09:55:38 +01:00
parent 75dbad7406
commit 7495fb9af4
58 changed files with 1437 additions and 42 deletions

View File

@@ -0,0 +1,45 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class TwigEnvironmentPassTest extends TestCase
{
public function testTwigBridgeExtensionsAreRegisteredFirst()
{
$container = new ContainerBuilder();
$twigDefinition = $container->register('twig');
$container->register('other_extension', 'Foo\Bar')
->addTag('twig.extension');
$container->register('twig_bridge_extension', FormExtension::class)
->addTag('twig.extension');
$twigEnvironmentPass = new TwigEnvironmentPass();
$twigEnvironmentPass->process($container);
$methodCalls = $twigDefinition->getMethodCalls();
$this->assertCount(2, $methodCalls);
$twigBridgeExtensionReference = $methodCalls[0][1][0];
$this->assertInstanceOf(Reference::class, $twigBridgeExtensionReference);
$this->assertSame('twig_bridge_extension', (string) $twigBridgeExtensionReference);
$otherExtensionReference = $methodCalls[1][1][0];
$this->assertInstanceOf(Reference::class, $otherExtensionReference);
$this->assertSame('other_extension', (string) $otherExtensionReference);
}
}