You are here

public function Twig_Tests_NodeVisitor_OptimizerTest::testRenderParentBlockOptimizer 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::testRenderParentBlockOptimizer()

File

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

Class

Twig_Tests_NodeVisitor_OptimizerTest

Code

public function testRenderParentBlockOptimizer() {
  $env = new Twig_Environment($this
    ->getMock('Twig_LoaderInterface'), array(
    'cache' => false,
    'autoescape' => false,
  ));
  $stream = $env
    ->parse($env
    ->tokenize('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index'));
  $node = $stream
    ->getNode('blocks')
    ->getNode('content')
    ->getNode(0)
    ->getNode('body');
  $this
    ->assertEquals('Twig_Node_Expression_Parent', get_class($node));
  $this
    ->assertTrue($node
    ->getAttribute('output'));
}