ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Twig_Tests_Node_IncludeTest Class Reference
+ Inheritance diagram for Twig_Tests_Node_IncludeTest:
+ Collaboration diagram for Twig_Tests_Node_IncludeTest:

Public Member Functions

 testConstructor ()
 
 getTests ()
 
- Public Member Functions inherited from Twig_Test_NodeTestCase
 getTests ()
 
 testCompile ($node, $source, $environment=null, $isPattern=false)
 getTests More...
 
 assertNodeCompilation ($source, Twig_Node $node, Twig_Environment $environment=null, $isPattern=false)
 

Additional Inherited Members

- Protected Member Functions inherited from Twig_Test_NodeTestCase
 getCompiler (Twig_Environment $environment=null)
 
 getEnvironment ()
 
 getVariableGetter ($name, $line=false)
 
 getAttributeGetter ()
 

Detailed Description

Definition at line 12 of file IncludeTest.php.

Member Function Documentation

◆ getTests()

Twig_Tests_Node_IncludeTest::getTests ( )

Definition at line 29 of file IncludeTest.php.

References array, and EOF.

30  {
31  $tests = array();
32 
33  $expr = new Twig_Node_Expression_Constant('foo.twig', 1);
34  $node = new Twig_Node_Include($expr, null, false, false, 1);
35  $tests[] = array($node, <<<EOF
36 // line 1
37 \$this->loadTemplate("foo.twig", null, 1)->display(\$context);
38 EOF
39  );
40 
42  new Twig_Node_Expression_Constant(true, 1),
43  new Twig_Node_Expression_Constant('foo', 1),
44  new Twig_Node_Expression_Constant('foo', 1),
45  0
46  );
47  $node = new Twig_Node_Include($expr, null, false, false, 1);
48  $tests[] = array($node, <<<EOF
49 // line 1
50 \$this->loadTemplate(((true) ? ("foo") : ("foo")), null, 1)->display(\$context);
51 EOF
52  );
53 
54  $expr = new Twig_Node_Expression_Constant('foo.twig', 1);
56  $node = new Twig_Node_Include($expr, $vars, false, false, 1);
57  $tests[] = array($node, <<<EOF
58 // line 1
59 \$this->loadTemplate("foo.twig", null, 1)->display(array_merge(\$context, array("foo" => true)));
60 EOF
61  );
62 
63  $node = new Twig_Node_Include($expr, $vars, true, false, 1);
64  $tests[] = array($node, <<<EOF
65 // line 1
66 \$this->loadTemplate("foo.twig", null, 1)->display(array("foo" => true));
67 EOF
68  );
69 
70  $node = new Twig_Node_Include($expr, $vars, true, true, 1);
71  $tests[] = array($node, <<<EOF
72 // line 1
73 try {
74  \$this->loadTemplate("foo.twig", null, 1)->display(array("foo" => true));
75 } catch (Twig_Error_Loader \$e) {
76  // ignore missing template
77 }
78 EOF
79  );
80 
81  return $tests;
82  }
Represents an include node.
Definition: Include.php:18
Exception thrown when an error occurs during template loading.
Definition: Loader.php:25
Create styles array
The data for the language used.
const EOF
How fgetc() reports an End Of File.
Definition: JSMin_lib.php:92

◆ testConstructor()

Twig_Tests_Node_IncludeTest::testConstructor ( )

Definition at line 14 of file IncludeTest.php.

References array.

15  {
16  $expr = new Twig_Node_Expression_Constant('foo.twig', 1);
17  $node = new Twig_Node_Include($expr, null, false, false, 1);
18 
19  $this->assertFalse($node->hasNode('variables'));
20  $this->assertEquals($expr, $node->getNode('expr'));
21  $this->assertFalse($node->getAttribute('only'));
22 
24  $node = new Twig_Node_Include($expr, $vars, true, false, 1);
25  $this->assertEquals($vars, $node->getNode('variables'));
26  $this->assertTrue($node->getAttribute('only'));
27  }
Represents an include node.
Definition: Include.php:18
Create styles array
The data for the language used.

The documentation for this class was generated from the following file: