Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wbloszyk committed Jun 16, 2020
1 parent 8e9d572 commit 0fb5608
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Resources/config/twig_string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<service id="sonata.string.twig.extension" class="Sonata\AdminBundle\Twig\Extension\StringExtension">
<tag name="twig.extension"/>
<argument>null</argument>
<argument>true</argument>
</service>
</services>
</container>
6 changes: 6 additions & 0 deletions tests/DependencyInjection/SonataAdminExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit 0fb5608

Please sign in to comment.