public function Twig_Tests_ExpressionParserTest::testStringExpression

@dataProvider getTestsForString

File

drupal/core/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php, line 162

Class

Twig_Tests_ExpressionParserTest

Code

public function testStringExpression($template, $expected) {
  $env = new Twig_Environment(new Twig_Loader_String(), array(
    'cache' => false,
    'autoescape' => false,
    'optimizations' => 0,
  ));
  $stream = $env
    ->tokenize($template, 'index');
  $parser = new Twig_Parser($env);
  $this
    ->assertEquals($expected, $parser
    ->parse($stream)
    ->getNode('body')
    ->getNode(0)
    ->getNode('expr'));
}