Skip to content

[TwigBridge] Improve error rendering when running tests #58456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
Another iteration
  • Loading branch information
javiereguiluz committed Oct 9, 2024
commit 332ee7ee14b0c73f9dd55eae6836504438e1e808
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testCliRenderer()
$exception = new NotFoundHttpException();
$twig = new Environment(new ArrayLoader([]));

$exception = (new TwigErrorRenderer($twig, null, false))->render($exception);
$exception = (new TwigErrorRenderer($twig, new CliErrorRenderer(), false))->render($exception);

$exceptionHeaders = $exception->getHeaders();
if (isset($exceptionHeaders['Content-Type'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function load(array $configs, ContainerBuilder $container): void
{
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('twig.php');
$loader->load('twig_test.php');

if (method_exists(Environment::class, 'resetGlobals')) {
$container->getDefinition('twig')->addTag('kernel.reset', ['method' => 'resetGlobals']);
Expand Down
29 changes: 0 additions & 29 deletions src/Symfony/Bundle/TwigBundle/Resources/config/twig_test.php

This file was deleted.

2 changes: 2 additions & 0 deletions src/Symfony/Bundle/TwigBundle/TwigBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bundle\TwigBundle;

use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ErrorRendererPass;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass;
Expand All @@ -36,6 +37,7 @@
$container->addCompilerPass(new TwigEnvironmentPass());
$container->addCompilerPass(new TwigLoaderPass());
$container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING);
$container->addCompilerPass(new ErrorRendererPass());

Check failure on line 40 in src/Symfony/Bundle/TwigBundle/TwigBundle.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Bundle/TwigBundle/TwigBundle.php:40:41: UndefinedClass: Class, interface or enum named Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ErrorRendererPass does not exist (see https://psalm.dev/019)

Check failure on line 40 in src/Symfony/Bundle/TwigBundle/TwigBundle.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Bundle/TwigBundle/TwigBundle.php:40:41: UndefinedClass: Class, interface or enum named Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ErrorRendererPass does not exist (see https://psalm.dev/019)
}

public function registerCommands(Application $application): void
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy