You are here

public function Twig_Tests_NodeVisitor_OptimizerTest::testForOptimizer in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php \Twig_Tests_NodeVisitor_OptimizerTest::testForOptimizer()

@dataProvider getTestsForForOptimizer

File

vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php, line 55

Class

Twig_Tests_NodeVisitor_OptimizerTest

Code

public function testForOptimizer($template, $expected) {
  $env = new Twig_Environment($this
    ->getMock('Twig_LoaderInterface'), array(
    'cache' => false,
  ));
  $stream = $env
    ->parse($env
    ->tokenize($template, 'index'));
  foreach ($expected as $target => $withLoop) {
    $this
      ->assertTrue($this
      ->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : ''));
  }
}