From 0fb5608e4e65d99dd1a85e65b63fcdb4827e6e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20B=C5=82oszyk?= Date: Tue, 16 Jun 2020 17:04:34 +0200 Subject: [PATCH] Fix --- src/Resources/config/twig_string.xml | 1 + tests/DependencyInjection/SonataAdminExtensionTest.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/Resources/config/twig_string.xml b/src/Resources/config/twig_string.xml index 64241ad37d3..57790c5ebe9 100644 --- a/src/Resources/config/twig_string.xml +++ b/src/Resources/config/twig_string.xml @@ -4,6 +4,7 @@ null + true diff --git a/tests/DependencyInjection/SonataAdminExtensionTest.php b/tests/DependencyInjection/SonataAdminExtensionTest.php index 00156c593b8..298aff9927e 100644 --- a/tests/DependencyInjection/SonataAdminExtensionTest.php +++ b/tests/DependencyInjection/SonataAdminExtensionTest.php @@ -40,6 +40,7 @@ use Sonata\AdminBundle\Translator\UnderscoreLabelTranslatorStrategy; use Sonata\AdminBundle\Twig\GlobalVariables; use Symfony\Component\Config\Definition\Processor; +use Twig\Extensions\TextExtension; class SonataAdminExtensionTest extends AbstractExtensionTestCase { @@ -348,6 +349,11 @@ public function testLegacyTextExtensionConfiguration(): void if (isset($bundles['SonataCoreBundle'])) { $this->assertSame('sonata.core.twig.extension.text', (string) $this->container->getDefinition('sonata.string.twig.extension')->getArgument(0)); + } elseif (isset($bundles['SonataTwigBundle']) && $this->container->hasDefinition('sonata.twig.extension.deprecated_text_extension')) { + $this->assertSame('sonata.twig.extension.deprecated_text_extension', (string) $this->container->getDefinition('sonata.string.twig.extension')->getArgument(0)); + } elseif (class_exists(TextExtension::class)) { + $argument = $this->container->getDefinition('sonata.string.twig.extension')->getArgument(0); + $this->assertTrue($argument instanceof TextExtension); } else { $this->assertNull($this->container->getDefinition('sonata.string.twig.extension')->getArgument(0)); }