]> git.immae.eu Git - github/wallabag/wallabag.git/blame - vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php
gitignore vendor
[github/wallabag/wallabag.git] / vendor / twig / twig / test / Twig / Tests / Node / ImportTest.php
CommitLineData
4f5b44bd
NL
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
12class Twig_Tests_Node_ImportTest extends Twig_Test_NodeTestCase
13{
14 /**
15 * @covers Twig_Node_Import::__construct
16 */
17 public function testConstructor()
18 {
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);
22
23 $this->assertEquals($macro, $node->getNode('expr'));
24 $this->assertEquals($var, $node->getNode('var'));
25 }
26
27 /**
28 * @covers Twig_Node_Import::compile
29 * @dataProvider getTests
30 */
31 public function testCompile($node, $source, $environment = null)
32 {
33 parent::testCompile($node, $source, $environment);
34 }
35
36 public function getTests()
37 {
38 $tests = array();
39
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);
43
44 $tests[] = array($node, <<<EOF
45// line 1
46\$context["macro"] = \$this->env->loadTemplate("foo.twig");
47EOF
48 );
49
50 return $tests;
51 }
52}