assertEquals($names, $node->getNode('names')); $this->assertEquals($values, $node->getNode('values')); $this->assertEquals(false, $node->getAttribute('capture')); } /** * @covers Twig_Node_Set::compile * @dataProvider getTests */ public function testCompile($node, $source, $environment = null) { parent::testCompile($node, $source, $environment); } public function getTests() { $tests = array(); $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 0)), array(), 0); $node = new Twig_Node_Set(false, $names, $values, 0); $tests[] = array($node, '$context["foo"] = "foo";'); $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); $values = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 0), 0)), array(), 0); $node = new Twig_Node_Set(true, $names, $values, 0); $tests[] = array($node, <<env->getCharset()); EOF ); $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); $values = new Twig_Node_Text('foo', 0); $node = new Twig_Node_Set(true, $names, $values, 0); $tests[] = array($node, '$context["foo"] = new Twig_Markup("foo", $this->env->getCharset());'); $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0), new Twig_Node_Expression_AssignName('bar', 0)), array(), 0); $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 0), new Twig_Node_Expression_Name('bar', 0)), array(), 0); $node = new Twig_Node_Set(false, $names, $values, 0); $tests[] = array($node, <<getVariableGetter('bar')}); EOF ); return $tests; } }