Skip to content

Commit

Permalink
Fix profiler test failure with symfony 6.2
Browse files Browse the repository at this point in the history
Fixes
```
1) Doctrine\Bundle\DoctrineBundle\Tests\ProfilerTest::testRender
Twig\Error\RuntimeError: Impossible to access an attribute ("statusText") on a boolean variable ("").

/home/runner/work/DoctrineBundle/DoctrineBundle/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/layout.html.twig:64
```
  • Loading branch information
ostrolucky committed Oct 2, 2022
1 parent 1af518a commit 06ab798
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Tests/ProfilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
use Symfony\Component\HttpKernel\Profiler\Profile;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
Expand Down Expand Up @@ -91,6 +93,15 @@ public function testRender(): void

$profile = new Profile('foo');
$profile->setMethod('GET');
$requestStack = new RequestStack();
$requestStack->push($request);

/** @psalm-suppress TooManyArguments Since Symfony 5.2 */
$requestDataCollector = new RequestDataCollector($requestStack);
$requestDataCollector->collect($request, new Response());
$requestDataCollector->lateCollect();

$profile->addCollector($requestDataCollector);

$output = $this->twig->render('db.html.twig', [
'request' => $request,
Expand Down

0 comments on commit 06ab798

Please sign in to comment.