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

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 SetTest.php.

Member Function Documentation

◆ getTests()

Twig_Tests_Node_SetTest::getTests ( )

Definition at line 25 of file SetTest.php.

References $names, array, EOF, and Twig_Test_NodeTestCase\getVariableGetter().

26  {
27  $tests = array();
28 
29  $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1);
30  $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1)), array(), 1);
31  $node = new Twig_Node_Set(false, $names, $values, 1);
32  $tests[] = array($node, <<<EOF
33 // line 1
34 \$context["foo"] = "foo";
35 EOF
36  );
37 
38  $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1);
39  $values = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 1), 1)), array(), 1);
40  $node = new Twig_Node_Set(true, $names, $values, 1);
41  $tests[] = array($node, <<<EOF
42 // line 1
43 ob_start();
44 echo "foo";
45 \$context["foo"] = ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());
46 EOF
47  );
48 
49  $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1);
50  $values = new Twig_Node_Text('foo', 1);
51  $node = new Twig_Node_Set(true, $names, $values, 1);
52  $tests[] = array($node, <<<EOF
53 // line 1
54 \$context["foo"] = ('' === \$tmp = "foo") ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());
55 EOF
56  );
57 
58  $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1), new Twig_Node_Expression_AssignName('bar', 1)), array(), 1);
59  $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Name('bar', 1)), array(), 1);
60  $node = new Twig_Node_Set(false, $names, $values, 1);
61  $tests[] = array($node, <<<EOF
62 // line 1
63 list(\$context["foo"], \$context["bar"]) = array("foo", {$this->getVariableGetter('bar')});
64 EOF
65  );
66 
67  return $tests;
68  }
Represents a node in the AST.
Definition: Node.php:18
Represents a set node.
Definition: Set.php:17
Represents a node that outputs an expression.
Definition: Print.php:18
Create styles array
The data for the language used.
Represents a text node.
Definition: Text.php:18
getVariableGetter($name, $line=false)
Marks a content as safe.
Definition: Markup.php:17
const EOF
How fgetc() reports an End Of File.
Definition: JSMin_lib.php:92
+ Here is the call graph for this function:

◆ testConstructor()

Twig_Tests_Node_SetTest::testConstructor ( )

Definition at line 14 of file SetTest.php.

References $names, and array.

15  {
16  $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1);
17  $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1)), array(), 1);
18  $node = new Twig_Node_Set(false, $names, $values, 1);
19 
20  $this->assertEquals($names, $node->getNode('names'));
21  $this->assertEquals($values, $node->getNode('values'));
22  $this->assertFalse($node->getAttribute('capture'));
23  }
Represents a node in the AST.
Definition: Node.php:18
Represents a set node.
Definition: Set.php:17
Create styles array
The data for the language used.

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