DumpExtension example

use Twig\Environment;
use Twig\Loader\ArrayLoader;
use Twig\Loader\LoaderInterface;

class DumpExtensionTest extends TestCase
{
    /** * @dataProvider getDumpTags */
    public function testDumpTag($template$debug$expectedOutput$expectedDumped)
    {
        $extension = new DumpExtension(new VarCloner());
        $twig = new Environment(new ArrayLoader(['template' => $template])[
            'debug' => $debug,
            'cache' => false,
            'optimizations' => 0,
        ]);
        $twig->addExtension($extension);

        $dumped = null;
        $exception = null;
        $prevDumper = VarDumper::setHandler(function D$var) use (&$dumped) { $dumped = $var});

        
Home | Imprint | This part of the site doesn't use cookies.