Skip to content

Commit e168b42

Browse files
committed
Merge branch '2.10.x' into 2.11.x
* 2.10.x: fix move of CodeExtension (#1725)
2 parents 3cdc411 + 1d2a578 commit e168b42

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Tests/ProfilerTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
use PHPUnit\Framework\TestCase as BaseTestCase;
99
use Symfony\Bridge\Doctrine\Middleware\Debug\DebugDataHolder;
1010
use Symfony\Bridge\Doctrine\Middleware\Debug\Query;
11-
use Symfony\Bridge\Twig\Extension\CodeExtension;
11+
use Symfony\Bridge\Twig\Extension\CodeExtension as CodeExtensionLegacy;
1212
use Symfony\Bridge\Twig\Extension\HttpKernelExtension;
1313
use Symfony\Bridge\Twig\Extension\HttpKernelRuntime;
1414
use Symfony\Bridge\Twig\Extension\RoutingExtension;
15+
use Symfony\Bundle\WebProfilerBundle\Profiler\CodeExtension;
1516
use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
1617
use Symfony\Component\HttpFoundation\Request;
1718
use Symfony\Component\HttpFoundation\RequestStack;
@@ -24,6 +25,7 @@
2425
use Twig\Loader\FilesystemLoader;
2526
use Twig\RuntimeLoader\RuntimeLoaderInterface;
2627

28+
use function class_exists;
2729
use function html_entity_decode;
2830
use function preg_match;
2931
use function preg_quote;
@@ -62,7 +64,12 @@ public function setUp(): void
6264
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
6365
$urlGenerator->method('generate')->willReturn('');
6466

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+
6673
$this->twig->addExtension(new RoutingExtension($urlGenerator));
6774
$this->twig->addExtension(new HttpKernelExtension());
6875
/**

0 commit comments

Comments
 (0)