1<?php 2 3/* 4 * This file is part of Twig. 5 * 6 * (c) Fabien Potencier 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12use Twig\Node\BlockNode; 13use Twig\Node\TextNode; 14use Twig\Test\NodeTestCase; 15 16class Twig_Tests_Node_BlockTest extends NodeTestCase 17{ 18 public function testConstructor() 19 { 20 $body = new TextNode('foo', 1); 21 $node = new BlockNode('foo', $body, 1); 22 23 $this->assertEquals($body, $node->getNode('body')); 24 $this->assertEquals('foo', $node->getAttribute('name')); 25 } 26 27 public function getTests() 28 { 29 $body = new TextNode('foo', 1); 30 $node = new BlockNode('foo', $body, 1); 31 32 return [ 33 [$node, <<<EOF 34// line 1 35public function block_foo(\$context, array \$blocks = []) 36{ 37 echo "foo"; 38} 39EOF 40 ], 41 ]; 42 } 43} 44