From 5b233a728622bcaf0b7fe28e8d0be1c2003b8466 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Wed, 3 Mar 2021 11:45:06 +0100 Subject: [PATCH] Register Twig bundle Twig Bundle is already required here. There's no reason not to register it automatically. --- .../TracyBlueScreenExtension.php | 2 +- src/TracyBlueScreenBundle.php | 8 +++++++ .../TracyBlueScreenBundleTest.php | 21 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/Cdn77/TracyBlueScreenBundle/TracyBlueScreenBundleTest.php diff --git a/src/DependencyInjection/TracyBlueScreenExtension.php b/src/DependencyInjection/TracyBlueScreenExtension.php index 45dcfe8..ad35220 100644 --- a/src/DependencyInjection/TracyBlueScreenExtension.php +++ b/src/DependencyInjection/TracyBlueScreenExtension.php @@ -26,7 +26,7 @@ final class TracyBlueScreenExtension extends ConfigurableExtension implements Pr public const CONTAINER_PARAMETER_CONSOLE_LISTENER_PRIORITY = 'cdn77.tracy_blue_screen.console.listener_priority'; public const CONTAINER_PARAMETER_CONSOLE_LOG_DIRECTORY = 'cdn77.tracy_blue_screen.console.log_directory'; public const CONTAINER_PARAMETER_CONTROLLER_LISTENER_PRIORITY = 'cdn77.tracy_blue_screen.controller.listener_priority'; - private const TWIG_BUNDLE_ALIAS = 'twig'; + public const TWIG_BUNDLE_ALIAS = 'twig'; private const TWIG_TEMPLATES_NAMESPACE = 'Twig'; public function prepend(ContainerBuilder $container) : void diff --git a/src/TracyBlueScreenBundle.php b/src/TracyBlueScreenBundle.php index 14181bd..a0444a6 100644 --- a/src/TracyBlueScreenBundle.php +++ b/src/TracyBlueScreenBundle.php @@ -4,8 +4,16 @@ namespace Cdn77\TracyBlueScreenBundle; +use Symfony\Bundle\TwigBundle\DependencyInjection\TwigExtension; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; final class TracyBlueScreenBundle extends Bundle { + public function build(ContainerBuilder $container) : void + { + parent::build($container); + + $container->registerExtension(new TwigExtension()); + } } diff --git a/tests/Cdn77/TracyBlueScreenBundle/TracyBlueScreenBundleTest.php b/tests/Cdn77/TracyBlueScreenBundle/TracyBlueScreenBundleTest.php new file mode 100644 index 0000000..eb2ae73 --- /dev/null +++ b/tests/Cdn77/TracyBlueScreenBundle/TracyBlueScreenBundleTest.php @@ -0,0 +1,21 @@ +build($containerBuilder); + + self::assertTrue($containerBuilder->hasExtension(TracyBlueScreenExtension::TWIG_BUNDLE_ALIAS)); + } +}