|
8 | 8 | use PHPUnit\Framework\TestCase as BaseTestCase;
|
9 | 9 | use Symfony\Bridge\Doctrine\Middleware\Debug\DebugDataHolder;
|
10 | 10 | use Symfony\Bridge\Doctrine\Middleware\Debug\Query;
|
11 |
| -use Symfony\Bridge\Twig\Extension\CodeExtension; |
| 11 | +use Symfony\Bridge\Twig\Extension\CodeExtension as CodeExtensionLegacy; |
12 | 12 | use Symfony\Bridge\Twig\Extension\HttpKernelExtension;
|
13 | 13 | use Symfony\Bridge\Twig\Extension\HttpKernelRuntime;
|
14 | 14 | use Symfony\Bridge\Twig\Extension\RoutingExtension;
|
| 15 | +use Symfony\Bundle\WebProfilerBundle\Profiler\CodeExtension; |
15 | 16 | use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
|
16 | 17 | use Symfony\Component\HttpFoundation\Request;
|
17 | 18 | use Symfony\Component\HttpFoundation\RequestStack;
|
|
24 | 25 | use Twig\Loader\FilesystemLoader;
|
25 | 26 | use Twig\RuntimeLoader\RuntimeLoaderInterface;
|
26 | 27 |
|
| 28 | +use function class_exists; |
27 | 29 | use function html_entity_decode;
|
28 | 30 | use function preg_match;
|
29 | 31 | use function preg_quote;
|
@@ -62,7 +64,12 @@ public function setUp(): void
|
62 | 64 | $urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
|
63 | 65 | $urlGenerator->method('generate')->willReturn('');
|
64 | 66 |
|
65 |
| - $this->twig->addExtension(new CodeExtension('', '', '')); |
| 67 | + if (class_exists(CodeExtension::class)) { |
| 68 | + $this->twig->addExtension(new CodeExtension('', '', '')); |
| 69 | + } else { |
| 70 | + $this->twig->addExtension(new CodeExtensionLegacy('', '', '')); |
| 71 | + } |
| 72 | + |
66 | 73 | $this->twig->addExtension(new RoutingExtension($urlGenerator));
|
67 | 74 | $this->twig->addExtension(new HttpKernelExtension());
|
68 | 75 | /**
|
|
0 commit comments