Skip to content

Commit

Permalink
fix move of CodeExtension (#1725)
Browse files Browse the repository at this point in the history
  • Loading branch information
chr-hertel committed Nov 11, 2023
1 parent 42f5834 commit 1d2a578
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Tests/ProfilerTest.php
Expand Up @@ -8,10 +8,11 @@
use PHPUnit\Framework\TestCase as BaseTestCase;
use Symfony\Bridge\Doctrine\Middleware\Debug\DebugDataHolder;
use Symfony\Bridge\Doctrine\Middleware\Debug\Query;
use Symfony\Bridge\Twig\Extension\CodeExtension;
use Symfony\Bridge\Twig\Extension\CodeExtension as CodeExtensionLegacy;
use Symfony\Bridge\Twig\Extension\HttpKernelExtension;
use Symfony\Bridge\Twig\Extension\HttpKernelRuntime;
use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Bundle\WebProfilerBundle\Profiler\CodeExtension;
use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
Expand All @@ -24,6 +25,7 @@
use Twig\Loader\FilesystemLoader;
use Twig\RuntimeLoader\RuntimeLoaderInterface;

use function class_exists;
use function html_entity_decode;
use function preg_match;
use function preg_quote;
Expand Down Expand Up @@ -62,7 +64,12 @@ public function setUp(): void
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
$urlGenerator->method('generate')->willReturn('');

$this->twig->addExtension(new CodeExtension('', '', ''));
if (class_exists(CodeExtension::class)) {
$this->twig->addExtension(new CodeExtension('', '', ''));
} else {
$this->twig->addExtension(new CodeExtensionLegacy('', '', ''));
}

$this->twig->addExtension(new RoutingExtension($urlGenerator));
$this->twig->addExtension(new HttpKernelExtension());
/**
Expand Down

0 comments on commit 1d2a578

Please sign in to comment.