Lines Matching refs:node

43         $node = new DummyNode('value1', 'value2', 'value3', $attributes);
46 [$attributes, $node],
53 public function testConstruct(array $attributes, Node $node) { argument
54 $this->assertSame('Dummy', $node->getType());
55 $this->assertSame(['subNode1', 'subNode2'], $node->getSubNodeNames());
56 $this->assertSame(10, $node->getLine());
57 $this->assertSame(10, $node->getStartLine());
58 $this->assertSame(11, $node->getEndLine());
59 $this->assertSame(12, $node->getStartTokenPos());
60 $this->assertSame(13, $node->getEndTokenPos());
61 $this->assertSame(14, $node->getStartFilePos());
62 $this->assertSame(15, $node->getEndFilePos());
63 $this->assertSame('/** doc comment */', $node->getDocComment()->getText());
64 $this->assertSame('value1', $node->subNode1);
65 $this->assertSame('value2', $node->subNode2);
66 $this->assertTrue(isset($node->subNode1));
67 $this->assertTrue(isset($node->subNode2));
68 $this->assertTrue(!isset($node->subNode3));
69 $this->assertSame($attributes, $node->getAttributes());
70 $this->assertSame($attributes['comments'], $node->getComments());
72 return $node;
78 public function testGetDocComment(array $attributes, Node $node): void { argument
79 $this->assertSame('/** doc comment */', $node->getDocComment()->getText());
80 $comments = $node->getComments();
83 $node->setAttribute('comments', $comments);
84 $this->assertNull($node->getDocComment());
87 $node->setAttribute('comments', []);
88 $this->assertNull($node->getDocComment());
92 $node = new DummyNode(null, null, null, []);
96 $node->setDocComment($docComment);
97 $this->assertSame($docComment, $node->getDocComment());
101 $node->setDocComment($docComment);
102 $this->assertSame($docComment, $node->getDocComment());
108 $node->setAttribute('comments', [$c1, $c2]);
109 $node->setDocComment($docComment);
110 $this->assertSame([$c1, $c2, $docComment], $node->getAttribute('comments'));
114 $node->setAttribute('comments', [$c1, $docComment, $c2]);
115 $node->setDocComment($newDocComment);
116 $this->assertSame([$c1, $newDocComment, $c2], $node->getAttribute('comments'));
122 public function testChange(array $attributes, DummyNode $node): void { argument
124 $node->subNode1 = 'newValue';
125 $this->assertSame('newValue', $node->subNode1);
128 $subNode = &$node->subNode1;
130 $this->assertSame('newNewValue', $node->subNode1);
133 unset($node->subNode1);
134 $this->assertFalse(isset($node->subNode1));
140 public function testIteration(array $attributes, Node $node): void { argument
144 foreach ($node as $key => $value) {
164 $node = $this->getMockForAbstractClass(NodeAbstract::class);
166 $this->assertEmpty($node->getAttributes());
168 $node->setAttribute('key', 'value');
169 $this->assertTrue($node->hasAttribute('key'));
170 $this->assertSame('value', $node->getAttribute('key'));
172 $this->assertFalse($node->hasAttribute('doesNotExist'));
173 $this->assertNull($node->getAttribute('doesNotExist'));
174 $this->assertSame('default', $node->getAttribute('doesNotExist', 'default'));
176 $node->setAttribute('null', null);
177 $this->assertTrue($node->hasAttribute('null'));
178 $this->assertNull($node->getAttribute('null'));
179 $this->assertNull($node->getAttribute('null', 'default'));
186 $node->getAttributes()
189 $node->setAttributes(
200 $node->getAttributes()