/** * @covers Twig_Node_Set::__construct */ public function testConstructor() { $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); $this->assertEquals($names, $node->getNode('names')); $this->assertEquals($values, $node->getNode('values')); $this->assertEquals(false, $node->getAttribute('capture')); }
/** * @param \Twig_Node_Set $node */ public function addSetCollection(\Twig_Node_Set $node) { try { $name = $node->getNode('names')->getNode('0')->getAttribute('name'); $value = $node->getNode('values')->getNode('0')->getAttribute('value'); } catch (\LogicException $e) { //TODO balancer une exception dans le log ou dans terminal } $this->setCollection[$name] = array('value' => $value); }