4 * This file is part of Twig.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 class Twig_Tests_Node_ImportTest
extends Twig_Test_NodeTestCase
15 * @covers Twig_Node_Import::__construct
17 public function testConstructor()
19 $macro = new Twig_Node_Expression_Constant('foo.twig', 1);
20 $var = new Twig_Node_Expression_AssignName('macro', 1);
21 $node = new Twig_Node_Import($macro, $var, 1);
23 $this->assertEquals($macro, $node->getNode('expr'));
24 $this->assertEquals($var, $node->getNode('var'));
28 * @covers Twig_Node_Import::compile
29 * @dataProvider getTests
31 public function testCompile($node, $source, $environment = null)
33 parent
::testCompile($node, $source, $environment);
36 public function getTests()
40 $macro = new Twig_Node_Expression_Constant('foo.twig', 1);
41 $var = new Twig_Node_Expression_AssignName('macro', 1);
42 $node = new Twig_Node_Import($macro, $var, 1);
44 $tests[] = array($node, <<<EOF
46 \$context["macro"] = \$this->env->loadTemplate("foo.twig");