ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Twig_Tests_Node_Expression_GetAttrTest Class Reference
+ Inheritance diagram for Twig_Tests_Node_Expression_GetAttrTest:
+ Collaboration diagram for Twig_Tests_Node_Expression_GetAttrTest:

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

Member Function Documentation

◆ getTests()

Twig_Tests_Node_Expression_GetAttrTest::getTests ( )

Definition at line 29 of file GetAttrTest.php.

References $tests, Twig_TemplateInterface\ANY_CALL, Twig_TemplateInterface\ARRAY_CALL, Twig_Test_NodeTestCase\getAttributeGetter(), Twig_Test_NodeTestCase\getVariableGetter(), and Twig_TemplateInterface\METHOD_CALL.

30  {
31  $tests = array();
32 
33  $expr = new Twig_Node_Expression_Name('foo', 1);
34  $attr = new Twig_Node_Expression_Constant('bar', 1);
35  $args = new Twig_Node_Expression_Array(array(), 1);
36  $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ANY_CALL, 1);
37  $tests[] = array($node, sprintf('%s%s, "bar", array())', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1)));
38 
39  $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1);
40  $tests[] = array($node, sprintf('%s%s, "bar", array(), "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1)));
41 
42  $args = new Twig_Node_Expression_Array(array(), 1);
43  $args->addElement(new Twig_Node_Expression_Name('foo', 1));
44  $args->addElement(new Twig_Node_Expression_Constant('bar', 1));
45  $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::METHOD_CALL, 1);
46  $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo')));
47 
48  return $tests;
49  }
$tests
Definition: bench.php:104
getVariableGetter($name, $line=false)
+ Here is the call graph for this function:

◆ testConstructor()

Twig_Tests_Node_Expression_GetAttrTest::testConstructor ( )

Definition at line 14 of file GetAttrTest.php.

References Twig_TemplateInterface\ARRAY_CALL.

15  {
16  $expr = new Twig_Node_Expression_Name('foo', 1);
17  $attr = new Twig_Node_Expression_Constant('bar', 1);
18  $args = new Twig_Node_Expression_Array(array(), 1);
19  $args->addElement(new Twig_Node_Expression_Name('foo', 1));
20  $args->addElement(new Twig_Node_Expression_Constant('bar', 1));
21  $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1);
22 
23  $this->assertEquals($expr, $node->getNode('node'));
24  $this->assertEquals($attr, $node->getNode('attribute'));
25  $this->assertEquals($args, $node->getNode('arguments'));
26  $this->assertEquals(Twig_Template::ARRAY_CALL, $node->getAttribute('type'));
27  }

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